Re: Multiple instances of NSApp/NSApplicationLoad()
Re: Multiple instances of NSApp/NSApplicationLoad()
- Subject: Re: Multiple instances of NSApp/NSApplicationLoad()
- From: Kevin Walzer <email@hidden>
- Date: Tue, 17 Feb 2009 09:58:56 -0500
- Organization: WordTech Communications LLC
Kevin Walzer wrote:
I have multiple calls to NSApp, which is apparently the problem--I am
not correctly setting the NSApp global. I've been advised to call
NSApplicationLoad(), since Tcl/Tk is currently based on Carbon, but I'm
not sure where to do this.
<snip>
Answers my own question: put the call in switchIcon, before calling
anything else in that method. cf:
-(int) switchIcon: (NSString *) iconPath {
NSApplicationLoad();
//set up autorelease pool
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//convert file path to URL
iconURL = [[NSURL alloc] initFileURLWithPath: iconPath];
//create image from URL
newIcon = [[NSImage alloc] initWithContentsOfURL: iconURL];
//set the new icon
[NSApp setApplicationIconImage: newIcon];
// [[CocoaDock tkdock] showApplicationIconImage: newIcon];
//release the memory
[newIcon release];
[iconURL release];
[pool release];
return 0;
}
--Kevin
--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden