Re: NSWindow setMiniwindowImage seems to do nothing
Re: NSWindow setMiniwindowImage seems to do nothing
- Subject: Re: NSWindow setMiniwindowImage seems to do nothing
- From: OS X AIBO <email@hidden>
- Date: Tue, 6 Aug 2002 14:58:26 -0700 (PDT)
--- Matthew Formica <email@hidden> wrote:
>
-applicationDidFinishLaunching is too late in the
>
startup process to
>
register the default; NSApplication has already read
>
its preferences. Set
>
the default in main() before NSApplicationMain().
>
>
- Matthew
>
>
--
>
>
Matthew Formica
>
DTS Engineer - Developer Tools and Cocoa
>
Apple Computer, Inc.
>
email@hidden
>
>
On 8/6/02 1:34 PM, "OS X AIBO" <email@hidden>
>
wrote:
>
>
> Sorry to bother the list with this question again
>
but
>
> I am stuck.
>
>
>
> For the aesthetic charm that such a feaure offers,
>
I
>
> want to have a custom image displayed for my
>
document
>
> window while it sits miniaturized in the dock. All
>
> evidence in the documentation points to this being
>
> possible, but my attempts thus far have failed.
>
>
>
> Has anyone managed to do this successfully?
>
>
>
> Ali Ozer <email@hidden> wrote in
>
>
>
http://lists.apple.com/archives/cocoa-dev/2001/Oct/30/contextmenuforminimisedw
>
> .005.txt
>
> You need to set a default, which you can do in the
>
> context of your app
>
> by registering it at startup. From the AppKit
>
release
>
> notes:
>
>
>
> There is a user default, AppleDockIconEnabled, to
>
> enable setting the image in a minimized window
>
tile
>
> with -[NSWindow setMiniwindowImage:]. The image
>
will
>
> be scaled as necessary to fit the tile. This
>
behavior
>
> is
>
> off by default, so you must set
>
AppleDockIconEnabled
>
> to YES if you want to enable this behavior.
>
>
>
> Fair enough. So, I added this to my app delegate's
>
> applicationDidFinishLaunching() implementation.
>
>
>
> NSUserDefaults standardUserDefaults =
>
> NSUserDefaults.standardUserDefaults();
>
>
>
> NSDictionary dict = new NSDictionary("YES",
>
> "AppleDockIconEnabled");
>
> standardUserDefaults.registerDefaults(dict);
>
>
>
>
>
>
>
>
>
> NSWindow setMiniwindowImage still seems to do
>
nothing.
>
> Can someone point out what I may have overlooked?
>
>
>
> Thanks,
>
> Dan
Taking your suggestion, I dusted off my Obj-C skills
and added
NSAutoreleasePool *pool = [[NSAutoreleasePool
alloc] init];
NSUserDefaults *userDefaults = [NSUserDefaults
standardUserDefaults];
NSDictionary *dict = [NSDictionary
dictionaryWithObject:@"YES"
forKey:@"AppleDockIconEnabled"];
[userDefaults registerDefaults:dict];
[pool release];
to main() before
return NSApplicationMain(argc, argv);
and things started working as documented.
Much obliged.
--Dan
Yahoo! Health - Feel better, live better
http://health.yahoo.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.