Re: Why would IBOutlet NSPanel *aWindow be nil?
Re: Why would IBOutlet NSPanel *aWindow be nil?
- Subject: Re: Why would IBOutlet NSPanel *aWindow be nil?
- From: Dale Gillard <email@hidden>
- Date: Sun, 10 Apr 2005 23:24:37 +1000
On 9 Apr 2005, at 10:52 PM, I wrote:
I've an existing Nib file to which I've added a new NSPanel. That is,
I've added an outlet to the IB instance, dragged and connected the
instance to the panel, and then added the IBOutlet reference to the .h
file using the code, IBOutlet NSPanel *aPanel.
But... when I run the project the new panel does not appear when I
send it a makeKeyAndOrderFront: message. I've run the app in the
debugger and the outlet is nil. Is there something I'm doing wrong?
Thanks.
More info: If I send a makeKeyAndOrderFront: message in awakeFromNib
then the NSPanel is displayed. But if I send the message later from a
different method the NSPanel does not appear. It's like Cocoa is not
retaining the outlet?! And it has me wondering whether I need to retain
the outlet in some way.
In this case I'm launching the app, doing some stuff, and then creating
anInstance with the [aClass alloc] init] messages. (The .h file for
aClass contains the outlet pointing to a NSPanel.) I send some message
to anInstance, including asking it to send its outlet the
makeKeyAndOrderFront: message to display the NSPanel. Every message
works fine, and the NSPanel outlet is nil so it fails to send the
makeKeyAndOrderFront: message.
Why is the outlet being initialised in awakeFromNib, but being released
before I can create an instance of the class which contains the outlet?
Any advice would be appreciated. I'm stumped!
Dale.
_______________________________________________
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