A matrix of NSColorWells?

2014-08-21 Thread C.W. Betts
Is there a way to create multiple color wells in a way similar to how NSMatrix 
creates a, well, matrix of UI objects?

I’m working on porting PlayerPRO to Cocoa, and currently I have a xib with 96 
separate color well objects. This takes awhile to load in Xcode and probably 
will take awhile for the app itself to load. Is there a way to speed up the 
process?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Address Book question

2013-12-16 Thread C.W. Betts
My best guess: the entitlements for your app doesn't include Address Book 
access. If you are getting this error and your app is not signed, file a bug 
report at Apple.

There might also be an Address Book mailing list. If there is, try asking your 
question there as well.
On Dec 9, 2013, at 9:56 PM, John MacMullin  wrote:

> I occasionally am getting the following message when I use the address book 
> api to add a record to my sharedAddressBook, which then causes the add to 
> fail:
> 
> is being ignored because main executable 
> (/System/Library/Frameworks/AddressBook.framework/Resources/AddressBookSync.app/Contents/MacOS/AddressBookSync)
>  is code signed with entitlements
> 
> What's causing this and how do I resolve the issue?
> 
> Best regards,
> 
> John
> ___
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Refreshing the NSOpenPanel?

2012-12-29 Thread C.W. Betts
It's not sandboxed.
On Dec 29, 2012, at 5:55 PM, Mike Abdullah  wrote:

> Is your app sandboxed? If so, does disabling the sandbox make a difference?
> 
> Sent from my iPad
> 
> On 30 Dec 2012, at 00:43, "C.W. Betts"  wrote:
> 
>> After I set an NSOpenPanel's allowed file types while it is open, it doesn't 
>> refresh until I move to a different folder. Is there a way to force 
>> NSOpenPanel to refresh its openable file type?
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Refreshing the NSOpenPanel?

2012-12-29 Thread C.W. Betts
After I set an NSOpenPanel's allowed file types while it is open, it doesn't 
refresh until I move to a different folder. Is there a way to force NSOpenPanel 
to refresh its openable file type?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problems with KVC

2012-11-23 Thread C.W. Betts

On Nov 23, 2012, at 9:57 PM, Quincey Morris 
 wrote:

> On Nov 23, 2012, at 20:18 , "C.W. Betts"  wrote:
> 
>> I'm trying to get my program PlayerPRO Cocoa to display the contents of the 
>> music list. I was able to put things into the list, but they do not show up 
>> in the table view.
>> (Full code is available at sourceforge.net/projects/playerpro, on the 
>> PlayerPRO6 branch)
>> 
>> I have it set up so that the App Delegate has a reference to the PPMusicList 
>> class defined as musicList. PPMusicList has a mutable array with contents of 
>> PPMusicListObject; the PPMusicListObject has two values: an NSURL that has 
>> the full path of a file (musicUrl), and the file's name (fileName). the 
>> PPMusicList class that has the following defines:
>> 
>> - (NSUInteger)countOfMusicList;
>> - (id)objectInMusicListAtIndex:(NSUInteger)idx;
>> - (void)insertObject:(id)anObj inMusicListAtIndex:(NSUInteger)idx;
>> - (void)removeObjectInMusicListAtIndex:(NSUInteger)object;
>> - (void)replaceObjectInMusicListAtIndex:(NSUInteger)index 
>> withObject:(id)anObject;
>> 
>> There is an Array controller bound to the app delegate with the model key 
>> path set to musicList and the table is bound to the array controller with 
>> the model key path set to fileName.
>> 
>> What am I doing wrong?
> 
> Your app delegate isn't KVO compliant for the "musicList" property. The 
> PPMusicList class isn't KVO compliant for the "musicList" property. In both 
> cases, you're altering an ivar (or the array pointed to by an ivar) directly, 
> so there are going to be no KVO notifications and bindings aren't going to 
> work.
Thank you. I'll look into implementing KVO.
> 
> You realize, don't you, that your array of PPMusicListObject instances is 
> appDelegate.musicList.musicList? That means your array controller requires a 
> key path of "musicList.musicList" too.
I thought that might be an issue. Thanks for confirming it.
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CF replacement to FSFindFolder?

2012-11-23 Thread C.W. Betts
I bit the bullet and my Plug-in handling code now has some Cocoa in it.
On Nov 2, 2012, at 6:59 PM, Sean McBride  wrote:

> On Fri, 2 Nov 2012 18:50:27 -0600, C.W. Betts said:
> 
>> Is there a Core Foundation replacement for FSFindFolder?
> 
> I don't think so.  Today's recommendation is NSFileManager's 
> URLForDirectory:inDomain:appropriateForURL:create:error:.
> 
>> I'm reluctant
>> to use Cocoa functions in my framework.
> 
> Why?
> 
>> As it is, I'm using an absolute
>> path to get to a folder in Application Support in both the local and
>> user libraries.
> 
> Which is fragile, as you know.
> 
> Cheers,
> 
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
> 
> 
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Problems with KVC

2012-11-23 Thread C.W. Betts
I'm trying to get my program PlayerPRO Cocoa to display the contents of the 
music list. I was able to put things into the list, but they do not show up in 
the table view.
(Full code is available at sourceforge.net/projects/playerpro, on the 
PlayerPRO6 branch)

I have it set up so that the App Delegate has a reference to the PPMusicList 
class defined as musicList. PPMusicList has a mutable array with contents of 
PPMusicListObject; the PPMusicListObject has two values: an NSURL that has the 
full path of a file (musicUrl), and the file's name (fileName). the PPMusicList 
class that has the following defines:

- (NSUInteger)countOfMusicList;
- (id)objectInMusicListAtIndex:(NSUInteger)idx;
- (void)insertObject:(id)anObj inMusicListAtIndex:(NSUInteger)idx;
- (void)removeObjectInMusicListAtIndex:(NSUInteger)object;
- (void)replaceObjectInMusicListAtIndex:(NSUInteger)index 
withObject:(id)anObject;

There is an Array controller bound to the app delegate with the model key path 
set to musicList and the table is bound to the array controller with the model 
key path set to fileName.

What am I doing wrong?
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


CF replacement to FSFindFolder?

2012-11-02 Thread C.W. Betts
Is there a Core Foundation replacement for FSFindFolder? I'm reluctant to use 
Cocoa functions in my framework. As it is, I'm using an absolute path to get to 
a folder in Application Support in both the local and user libraries.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


RE: I2C question - what is correct mailing list

2012-08-05 Thread C.W. Betts

My guess is either the darwin-kernel or darwin-drivers mailing list. Both can 
be found here: 
https://lists.apple.com/mailman/listinfo 

> Date: Fri, 27 Jul 2012 14:08:14 +0300
> From: vit...@qubyx.com
> To: cocoa-dev@lists.apple.com
> Subject: I2C question - what is correct mailing list
> 
> Hello,
> 
>   This is question to cocoa-dev moderators. I had asked twice question 
> about IOKit/i2c interface, but this messages was blocked as i understand.
> Can you please help to find correct mailing list for my question.
> 
> Thank you.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/computers57%40hotmail.com
> 
> This email sent to computer...@hotmail.com
  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UITableView woes

2012-07-02 Thread C.W. Betts
I'm trying to write an iOS app that displays sentences in a table, but 
UITableView cuts them off. Will I need to do a custom UITableViewCell or can I 
make UITableView behave? I want to either display them on two rows or have a 
scroll bar to see the rest of the sentence. 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can't get UTI to stick

2012-04-06 Thread C.W. Betts
Try making the UTI UTTypeConformsTo to also include public.data. Also, make 
sure in the Spotlight importer that the app's UTI is being imported.
If you do mdls on a .tgc file, what do you get?
On Apr 2, 2012, at 7:02 PM, Jo Meder wrote:

> Hi,
> 
> I've written a Quick Look generator for one of my app's file types. As part 
> of that I've defined a UTI for that file type. However whatever I do I can't 
> the UTI to stick. I've rebuilt the app, moved it around and used lsregister 
> to kill the Launch Services database and rebuild it. Dumping the Launch 
> Services database shows that the UTI isn't being picked up from the app. It's 
> not happening on 10.5 or 10.6. Here are the relevant parts of my app's plist:
> 
> UTExportedTypeDeclarations
>   
>   
>   UTTypeTagSpecification
>   
>   public.filename-extension
>   
>   tgc
>   TGC
>   
>   
>   UTTypeDescription
>   Terragen 2 Clip document
>   UTTypeConformsTo
>   
>   public.xml
>   
>   UTTypeIdentifier
>   
>   
> uk.co.planetside.Terragen_2.clip
>   
>   
>   
> 
> CFBundleDocumentTypes
>   
>   
>   LSItemContentTypes
>   
>   
> uk.co.planetside.Terragen_2.clip
>   
>   CFBundleOSTypes
>   
>   TG2C
>   
>   CFBundleTypeExtensions
>   
>   TGC
>   tgc
>   
>   CFBundleTypeIconFile
>   TGC.icns
>   CFBundleTypeName
>   Terragen 2 Clip document
>   CFBundleTypeRole
>   Editor
>   
>   
> 
> I have tried commenting out the CFBundleDocumentTypes section so there is 
> just the UTI but that didn't help.
> 
> Can you see something wrong with the above? I'd greatly appreciate any help. 
> So far I've spent longer trying to get this to work than I did on the Quick 
> Look generator itself.
> 
> Regards,
> 
> Jo Meder
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/computers57%40hotmail.com
> 
> This email sent to computer...@hotmail.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Handling UTIs from a Cocoa protocol

2011-12-18 Thread C.W. Betts
Thanks for the input everyone.

For those curious, this is the final code:
- (BOOL)application:(NSApplication *)theApplication openFile:(NSString 
*)filename
{
NSError *err = nil;
NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename 
error:&err];
if (err) {
NSRunAlertPanel(NSLocalizedString(@"Error opening file",nil), 
[NSString stringWithFormat:NSLocalizedString(@"Unable to open %@: %@", nil), 
[filename lastPathComponent], [err localizedFailureReason]], nil, nil, nil);
return NO;
}
NSArray *handlers = [NSArray arrayWithObjects:[PcsxrPluginHandler 
class], [PcsxrMemCardHandler class], [PcsxrFreezeStateHandler class], 
[PcsxrDiscHandler class], nil];
BOOL isHandled = NO;
for (Class fileHandler in handlers) {
NSObject *hand = [[fileHandler alloc] init];
BOOL canHandle = NO;
for (NSString *uti in [fileHandler supportedUTIs]) {
if ([[NSWorkspace sharedWorkspace] type:utiFile  
conformsToType:uti]) {
canHandle = YES;
}
}   
if (canHandle) {
isHandled = [hand handleFile:HandleBinCue(filename)];
}
[hand release];

}
return isHandled;
}


On Dec 18, 2011, at 12:22 PM, Charles Srstka wrote:

> You can just send the alloc/init message directly to the class object.
> 
> Charles
> 
> On Dec 18, 2011, at 11:01 AM, C.W. Betts wrote:
> 
>> Let me see if I got this right. Create an NSArray with classes like this:
>> [NSArray arrayWithObjects:[ClassName1 class], [ClassName2 class], nil]
>> Then how would I call it? Would [[[anArray objectAtIndex:i] alloc] init] 
>> work? Or would I have to use a pure C method, something along the lines of 
>> getIdFromClass()?
>> On Dec 18, 2011, at 2:20 AM, Charles Srstka wrote:
>> 
>>> On Dec 18, 2011, at 3:14 AM, Ken Thomases wrote:
>>> 
>>>> On Dec 18, 2011, at 3:06 AM, Charles Srstka wrote:
>>>> 
>>>>> On Dec 18, 2011, at 2:49 AM, Ken Thomases wrote:
>>>>> 
>>>>>> On Dec 18, 2011, at 2:36 AM, Charles Srstka wrote:
>>>>>> 
>>>>>>> On Dec 18, 2011, at 2:31 AM, C.W. Betts wrote:
>>>>>>> 
>>>>>>>> So I would do something along the lines of [NSArray 
>>>>>>>> arrayWithObjects:ClassName1, ClassName2, nil]?
>>>>>>> 
>>>>>>> Or just class1, class2, etc. where class1 and class2 are both of type 
>>>>>>> Class.
>>>>>> 
>>>>>> You can use pointers to class objects, but you can't just use class 
>>>>>> names.  If you are starting from class names, you use [ClassName1 class] 
>>>>>> to get the class object.
>>>>> 
>>>>> Well, you *could* just use class names, if you used NSClassFromString() 
>>>>> before using the class. There wouldn’t be much point in doing that, 
>>>>> though, since class objects can fit inside arrays and would be more 
>>>>> convenient to use here.
>>>> 
>>>> Did you mean for this to be off-list?  Anyway, I took his use of 
>>>> ClassName1 to mean an identifier.  After all, he didn't write 
>>>> @"ClassName1”.
>>> 
>>> Nope, sorry, that was meant to be on-list. You’re probably right — I had 
>>> assumed that those were meant to be NSString variables, since that’s what 
>>> you’d need to be using if you were storing class names. Wasn’t thinking 
>>> from an Obj-C newbie perspective there; sorry. At any rate, getting the 
>>> class object by calling +class is, of course, the correct thing to do.
>>> 
>>> Charles
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/computers57%40hotmail.com
>>> 
>>> This email sent to computer...@hotmail.com
>>> 
>> 
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Handling UTIs from a Cocoa protocol

2011-12-18 Thread C.W. Betts
So I would do something along the lines of [NSArray 
arrayWithObjects:ClassName1, ClassName2, nil]?
On Dec 17, 2011, at 9:51 PM, Chris Hanson wrote:

> On Dec 17, 2011, at 6:02 PM, C.W. Betts wrote:
> 
>> Is there a way to put classes into some sort of array to go through and 
>> check if the UTI of a file matches up to any of the UTIs that the class can 
>> handle?
> 
> Classes are objects too, so you can put them in arrays and so on.
> 
>  -- Chris
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Handling UTIs from a Cocoa protocol

2011-12-17 Thread C.W. Betts
This is how I have my code set up: an Objective-C protocol that has a class 
function that returns an NSArray of UTIs that it can handle, and a member 
function that handles the file type:

@protocol PcsxrFileHandle 

+ (NSArray *)utisCanHandle;
- (BOOL)handleFile:(NSString *)theFile;

@end

However, as my code is currently set up, the UTIs are used in a few special 
cases and are not called in determining what UTI opens what file. The code is 
set up like so:

- (BOOL)application:(NSApplication *)theApplication openFile:(NSString 
*)filename
{
NSString *utiFile = [[NSWorkspace sharedWorkspace] typeOfFile:filename 
error:nil];
NSObject *hand = nil;
BOOL isHandled = NO;
if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.plugin"), 
(CFStringRef)utiFile)) {
hand = [[PcsxrPluginHandler alloc] init];
isHandled = [hand handleFile:filename];
} else if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.memcard"), 
(CFStringRef)utiFile)) {
hand = [[PcsxrMemCardHandler alloc] init];
isHandled = [hand handleFile:filename];
} else if(UTTypeEqual(CFSTR("com.codeplex.pcsxr.freeze"), 
(CFStringRef)utiFile)) {
hand = [[PcsxrFreezeStateHandler alloc] init];
isHandled = [hand handleFile:filename];
} else if(UTTypeEqual(CFSTR("com.alcohol-soft.mdfdisc"), 
(CFStringRef)utiFile) || UTTypeEqual(CFSTR("com.apple.disk-image-ndif"), 
(CFStringRef)utiFile) || UTTypeEqual(CFSTR("public.iso-image"), 
(CFStringRef)utiFile) || UTTypeEqual(CFSTR("com.codeplex.pcsxr.cuefile"), 
(CFStringRef)utiFile)) {
hand = [[PcsxrDiscHandler alloc] init];
isHandled = [hand handleFile:HandleBinCue(filename)];
}
if (hand) [hand release];
return isHandled;
}

The PcsxrPluginHandler, PcsxrMemCardHandler, PcsxrFreezeStateHandler, and 
PcsxrDiscHandler all implement the PcsxrFileHandle protocol.
Is there a way to put classes into some sort of array to go through and check 
if the UTI of a file matches up to any of the UTIs that the class can handle?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Best way to manage double-clicked files?

2011-12-12 Thread C.W. Betts
Thank you! That was exactly what I was looking for.
On Dec 10, 2011, at 6:00 PM, Lee Ann Rucker wrote:

> Try the application delegate method application:openFile: - it gets called 
> before the NSDocument handling gets a shot at it.
> 
> - Original Message -----
> From: "C.W. Betts" 
> To: "julius" , "Cocoa Development" 
> 
> Sent: Saturday, December 10, 2011 4:51:44 PM
> Subject: Re: Best way to manage double-clicked files?
> 
> 
> On Dec 10, 2011, at 8:23 AM, julius wrote:
> 
>> On Fri, 09 Dec 2011 13:14:26 -0700 C.W. Betts wrote
>>> 
>>> What is the best way to handle double-clicked files in an application that 
>>> doesn't use documents? The reason I ask is because a project I'm working 
>>> on, PCSX-R, currently uses NSDocument subclasses to handle opening of files 
>>> double-clicked in the Finder. However, the 
>>> readFromFileWrapper:ofType:error: function returns NO even if the file is 
>>> loaded to prevent the document window from popping up (I have it se with no 
>>> close buttons; the window is called modally), but it shows an error that 
>>> the file wasn't opened, despite it being so.  Should I use a different way 
>>> of managing double-clicked files, or is there a function that I should 
>>> overload on my NSDocument subclass?
>>> 
>>> --
>> Hi, 
>> not sure if understand your question.
>> 
>> I am assuming
>> 1. you want program to start from double click of document file
>> 2. you want to be able to open program by clicking application file but do 
>> not want the app to open an empty document window.
>> 
> I want it so that when I double-click a file in Finder, a window pops up and 
> lets me select an option, then the window goes away. I'm wondering if 
> NSDocument is the best way to do this, or if another method would be better 
> suited.  This is the current code I'm using for the memory card chooser:
> 
> - (int)showMemoryCardChooserForFile:(NSString *)theFile
> {
>   if (!changeMemCardSheet) {
>   [NSBundle loadNibNamed:[self windowNibName] owner:self];
>   }
>   [cardPath setObjectValue:theFile];
>   
>   [NSApp runModalForWindow:changeMemCardSheet];
>   
>   [NSApp endSheet:changeMemCardSheet];
>   [changeMemCardSheet orderOut:self];
>   
>   return memChosen;
> }
> 
> - (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString 
> *)typeName error:(NSError **)outError
> {
>   int chosen = [self showMemoryCardChooserForFile:[fileWrapper filename]];
>   if (chosen == 0) {
>   return NO;
>   } else {
>   [ConfigurationController setMemoryCard:chosen toPath:[[self 
> fileURL] path]];
>   //TODO: make this return YES so that "File Can't be Opened" 
> dialog box doesn't pop up, but the window itself doesn't stay on the screen.
>   return NO;
>   }
> }
> It is returning NO because if I return YES, after the modal window pops up, a 
> button is pressed that will dismiss the modal dialog, the window pops up 
> again, non-modal this time, making the button that would have closed it not 
> work. But because I return NO, a message pops up that says the file could not 
> be opened. I want to fix that if at all possible.
> 
> I already discovered the fix for no. 
> 2.___
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Best way to manage double-clicked files?

2011-12-10 Thread C.W. Betts

On Dec 10, 2011, at 8:23 AM, julius wrote:

> On Fri, 09 Dec 2011 13:14:26 -0700 C.W. Betts wrote
>> 
>> What is the best way to handle double-clicked files in an application that 
>> doesn't use documents? The reason I ask is because a project I'm working on, 
>> PCSX-R, currently uses NSDocument subclasses to handle opening of files 
>> double-clicked in the Finder. However, the readFromFileWrapper:ofType:error: 
>> function returns NO even if the file is loaded to prevent the document 
>> window from popping up (I have it se with no close buttons; the window is 
>> called modally), but it shows an error that the file wasn't opened, despite 
>> it being so.  Should I use a different way of managing double-clicked files, 
>> or is there a function that I should overload on my NSDocument subclass?
>> 
>> --
> Hi, 
> not sure if understand your question.
> 
> I am assuming
> 1. you want program to start from double click of document file
> 2. you want to be able to open program by clicking application file but do 
> not want the app to open an empty document window.
> 
I want it so that when I double-click a file in Finder, a window pops up and 
lets me select an option, then the window goes away. I'm wondering if 
NSDocument is the best way to do this, or if another method would be better 
suited.  This is the current code I'm using for the memory card chooser:

- (int)showMemoryCardChooserForFile:(NSString *)theFile
{
if (!changeMemCardSheet) {
[NSBundle loadNibNamed:[self windowNibName] owner:self];
}
[cardPath setObjectValue:theFile];

[NSApp runModalForWindow:changeMemCardSheet];

[NSApp endSheet:changeMemCardSheet];
[changeMemCardSheet orderOut:self];

return memChosen;
}

- (BOOL)readFromFileWrapper:(NSFileWrapper *)fileWrapper ofType:(NSString 
*)typeName error:(NSError **)outError
{
int chosen = [self showMemoryCardChooserForFile:[fileWrapper filename]];
if (chosen == 0) {
return NO;
} else {
[ConfigurationController setMemoryCard:chosen toPath:[[self 
fileURL] path]];
//TODO: make this return YES so that "File Can't be Opened" 
dialog box doesn't pop up, but the window itself doesn't stay on the screen.
return NO;
}
}
It is returning NO because if I return YES, after the modal window pops up, a 
button is pressed that will dismiss the modal dialog, the window pops up again, 
non-modal this time, making the button that would have closed it not work. But 
because I return NO, a message pops up that says the file could not be opened. 
I want to fix that if at all possible.

I already discovered the fix for no. 
2.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Best way to manage double-clicked files?

2011-12-09 Thread C.W. Betts
What is the best way to handle double-clicked files in an application that 
doesn't use documents? The reason I ask is because a project I'm working on, 
PCSX-R, currently uses NSDocument subclasses to handle opening of files 
double-clicked in the Finder. However, the readFromFileWrapper:ofType:error: 
function returns NO even if the file is loaded to prevent the document window 
from popping up (I have it se with no close buttons; the window is called 
modally), but it shows an error that the file wasn't opened, despite it being 
so.  Should I use a different way of managing double-clicked files, or is there 
a function that I should overload on my NSDocument 
subclass?___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: UTI not being imported?

2011-12-06 Thread C.W. Betts
It is under UTImportedTypeDeclarations. I just copy-pasted the declaration 
without the array.
On Dec 6, 2011, at 12:02 PM, Kyle Sluder wrote:

> On Mon, Dec 5, 2011 at 1:10 PM, C.W. Betts  wrote:
>> I'm trying to use an imported UTI in an application, but it isn't working. 
>> This is the UTI declared in the info.plist file:
>> 
>> > "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
>> 
>> 
>>UTTypeConformsTo
> 
> You can't put the UTTypeConformsTo at the root of the Info.plist. It
> needs to be within a UTImportedTypeDeclarations dictionary key.
> 
> http://developer.apple.com/library/IOs/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html
> 
> --Kyle Sluder
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


UTI not being imported?

2011-12-06 Thread C.W. Betts
I'm trying to use an imported UTI in an application, but it isn't working. This 
is the UTI declared in the info.plist file:

http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


UTTypeConformsTo

public.disk-image
public.content
public.data

UTTypeDescription
PlayStation Disc
UTTypeIdentifier
com.codeplex.pcsxr.psxdiscfile
UTTypeTagSpecification

public.filename-extension

bin
img
mdf
iso





And I'm trying to get an open dialog to use it via this call:
[openDlg setAllowedFileTypes:[NSArray 
arrayWithObject:@"com.codeplex.pcsxr.psxdiscfile"]];
However, when I try to open a file (a empty file with .iso as the extension), I 
can't select it. What am I doing 
wrong?___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


using setPlaceholderString: in NSTextField

2010-09-06 Thread C.W. Betts
I would like to set it so that I can set the placeholder string 
programmatically.  However, when I do it, I get a warning at compile time and 
an error at runtime:
2010-09-06 15:42:01.617 System Preferences[50199:a0f] -[NSTextField 
setPlaceholderString:]: unrecognized selector sent to instance 0x200c2a220
Is there a way to use setPlaceholderString: on an NSTextField?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com