NSWindow custom controller class not displaying window
NSWindow custom controller class not displaying window
- Subject: NSWindow custom controller class not displaying window
- From: "Richard Northcott" <email@hidden>
- Date: Wed, 19 Oct 2005 17:37:42 +0100
- Thread-topic: NSWindow custom controller class not displaying window
I'm just starting out in Cocoa and am working my way through some examples in a (rather good) book. One of the tasks is to make a 2nd window (a NSPanel actually) which can be launched from a menu command (e.g. application preferences) in the main menu. Rather than including it in the main nib, a separate nib is constructed, which is loaded and opened when needed. It stays in memory for future. I have a menu action which creates a new instance of a custom controller class, and calls its showWindow action, roughly as below:
- (IBAction)showPreferencePanel:(id)sender
{
if(!preferenceController){
preferenceController = [[PreferenceController alloc] init];
}
[preferenceController showWindow:self];
}
Part of the custom controller looks like this:
- (id)init
{
self = [super initWithWindowNibName:@"Preferences"];
return self;
}
There was another method which I'm afraid I don't have in front of me, which was a delegate function called when the window was opened (similar to awakeFromNib). I put a few log items in, and can confirm that:
- the nib had been located and loaded
- the showWindow method is being called in the custom controller
- the delegate has been triggered, suggesting the window has been opened OK.
My problem is: I don't see the window (panel) on the screen when I run the app and select the menu command. There are no errors showing as such.
Can anyone shed any light on this? The nib file was made from scratch, with the file's owner set to a custom controller class (the item above subclassed from NSWindowController). Do I need to somehow identify the 'default' window within my new nib?
Thanks - Richard
Richard Northcott
SPS SOLUTIONS
Unit 6
Northolt Trading Estate
Belvue Road
Northolt
Middlesex
UB5 5QS
Office: +44 (0)870 240 0904
Mobile: +44 (0)7788 718 978
Fax: +44 (0)870 240 0905
www.showpres.co.uk <http://www.showpres.co.uk/>
_____
The information transmitted is intended only for the person or company to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or companies other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Although we make every effort to keep our network free from viruses, it is your responsibility to verify that this email and any attachments are free of viruses. We can take no responsibility for any computer virus that might be transferred by this e-mail.
Richard Northcott
SPS SOLUTIONS
Unit 6
Northolt Trading Estate
Belvue Road
Northolt
Middlesex
UB5 5QS
Office: +44 (0)870 240 0904
Mobile: +44 (0)7788 718 978
Fax: +44 (0)870 240 0905
www.showpres.co.uk <http://www.showpres.co.uk/>
_____
The information transmitted is intended only for the person or company to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or companies other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. Although we make every effort to keep our network free from viruses, it is your responsibility to verify that this email and any attachments are free of viruses. We can take no responsibility for any computer virus that might be transferred by this e-mail.
Scanned by MailDefender - managed email security from intY - www.maildefender.net
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden