On Apr 22, 2009, at 7:36 PM, Graham Cox wrote:


On 23/04/2009, at 10:19 AM, Chris Goedde wrote:
This isn't actually a preference panel, though, and I want the panel to open when the app launches so I added the line:

[ self showSettingsPanel: self ];

to the end of the awakeFromNib method of my main controller. Also works great, with one tiny exception. In both cases the panel has focus (either when opened from the Preferences... menu or at app launch). When the panel is opened from awakeFromNib, however, the main window has a light title bar, as if it's not frontmost. That's not the case when the panel is launched from the Preferences... menu. So my questions:

(1) Why does it make a difference how showSettingsPanel: is called?

(2) Is there a better way to do what I want to do?


I'd suggest using the main controller's -awakeFromNib method to open the panel is going to be too early. Instead, implement an application delegate (can be any object, wired up in IB in the MainMenu.xib/nib file) and implement -applicationDidFinishLaunching. That should ensure that everything is truly ready to go.

Thanks, that worked, once I added [ syncWindow makeKeyWindow ] (where syncWindow is an outlet to the main window) before calling showSettingsPanel:. I had tried that inside awakeFromNib, which didn't work, I guess because it was too early. Huh.

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

Reply via email to