FROM : James J. Merkel
DATE : Fri Nov 01 18:23:01 2002
On Friday, November 1, 2002, at 12:01 PM, Jerry LeVan wrote:
> Anyway it was suggested that I could capture the filename of the file
> dropped on the app icon by implementing the application:openfile
> method,
> here is what I added to the app:
> - (BOOL) application: (NSApplication*) anApplication
> openFile: (NSString* ) aFileName
> {
> // NSLog(@"Delegate invoked");
> NSBeep();
> theFile = [[[NSString alloc] initWithString:aFileName ] retain];
> return YES;
> }
>
> Regretably, as far as I can tell (no beep) the method is not invoked by
> dragging a file onto the app icon. It is not clear to me when the
> rascal
> would be invoked ( before awakeFromNib ?)
You need to have the following line of code in the same class that you
have the above code in:
[NSApp setDelegate:self];
I put it in the awakeFromNib method.
Hope this helps.
Jim Merkel
DATE : Fri Nov 01 18:23:01 2002
On Friday, November 1, 2002, at 12:01 PM, Jerry LeVan wrote:
> Anyway it was suggested that I could capture the filename of the file
> dropped on the app icon by implementing the application:openfile
> method,
> here is what I added to the app:
> - (BOOL) application: (NSApplication*) anApplication
> openFile: (NSString* ) aFileName
> {
> // NSLog(@"Delegate invoked");
> NSBeep();
> theFile = [[[NSString alloc] initWithString:aFileName ] retain];
> return YES;
> }
>
> Regretably, as far as I can tell (no beep) the method is not invoked by
> dragging a file onto the app icon. It is not clear to me when the
> rascal
> would be invoked ( before awakeFromNib ?)
You need to have the following line of code in the same class that you
have the above code in:
[NSApp setDelegate:self];
I put it in the awakeFromNib method.
Hope this helps.
Jim Merkel
| Related mails | Author | Date |
|---|---|---|
| Jerry LeVan | Nov 1, 08:14 | |
| Jeff Disher | Nov 1, 09:14 | |
| Jerry LeVan | Nov 1, 11:35 | |
| David Remahl | Nov 1, 11:39 | |
| Jerry LeVan | Nov 1, 12:15 | |
| James J. Merkel | Nov 1, 18:23 |






Cocoa mail archive

