Re: -[NSWindowController window] fails
Re: -[NSWindowController window] fails
- Subject: Re: -[NSWindowController window] fails
- From: Alexander Shmelev <email@hidden>
- Date: Fri, 28 Nov 2008 21:58:22 +0300
On 28.11.2008, at 21:46, j o a r wrote:
On Nov 28, 2008, at 9:12 PM, Alexander Shmelev wrote:
I cut off code after [self window], originally it looks like
following:
I suspected that you might have. In the future, please indicate this
more clearly.
Sorry, I promise to write code more clearly.
I tried to call [NSWindowController window] outside init, but it
fails.
Where and when did you make that call, and what do you mean with
"fails"? Returns "nil" instead of the window?
I have method in AppController class called showUi.
- (IBAction) showUi:(id)sender
{
if (!theDialog) {
theDialog = [[TwainDialog alloc] init];
[theDialog window]; // I use this only to force nib load
}
[theDialog showWindow:self];
}
When showUi is called first time, theDialog is nil, that's why if code
block is executed.
[[TwainDialog alloc] init] returns not nil value, but when I call
[theDialog window], there is error inside this method. But when I call
showIu second time, [theDialog window] passed and window is shown.
Actually my application is not stand-alone one, but TWAIN plug-in.
Everything works on Leopard, but I get aforementioned behavior on
Tiger(PPC).
Then I tried to replace NSWindowController and
initWithWindowNibName with NSObject and [NSBundle
loadNibNamed:owner:] but it fails too.
I tried to use NIB 2.x instead XIB 3.x, but it still fails.
Again, what does "fail" mean here? Have you made sure to connect the
window outlet from the window controller to the window in the nib
file? That's a *very* common source of problems.
Yes, I am sure that all connections are correct, because this code
works on Leopard.
In my experience window controllers are very robust and predictable.
I'm surprised to hear that you have problems. I suspect that we will
figure out what's wrong, and that you will be able to fix it easily
and then move on.
I hope so, because this is blocker issue for me.
j o a r
BR, Alexander
_______________________________________________
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