Quick question about adding an NSPanel
Quick question about adding an NSPanel
- Subject: Quick question about adding an NSPanel
- From: Chris Goedde <email@hidden>
- Date: Wed, 22 Apr 2009 19:19:07 -0500
Hi,
I have a quick question about adding an NSPanel to an app. I'm
following Hillegass's book, so I have a separate controller and nib
for the panel. I added an IBAction (showSettingsPanel:) to my main app
controller and hooked it up to the Preferences... menu item. Works
great.
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?
Code for showSettingsPanel: below (it's very simple, basically
straight from Hillegass).
Thanks.
Chris
- (IBAction) showSettingsPanel: (id) sender {
NSLog(@"In showSettingsPanel.");
if (!settingsController) {
settingsController = [ [ SettingsController alloc ] init ];
}
[ settingsController showWindow: self ];
}
_______________________________________________
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