Multiple movable modals
Multiple movable modals
- Subject: Multiple movable modals
- From: Andy Bettis <email@hidden>
- Date: Tue, 14 Jun 2005 13:46:26 +0100
Hello again,
In my app I want to display a moveable modal dialog. (Please take my
word that I have good reasons for doing this.) I have subclassed
NSWindowController to control the dialog, with an init method:
- (id)init
{
self = [super initWithWindowNibName:@"CCategoriesDialog"];
return(self);
}
I use a class method to start the dialog up:
+ (id)create:(MyDocument*) inDocument
{
CCategoriesDialog* theDialog = [[CCategoriesDialog alloc] init];
[theDialog setDocument:inDocument];
[[theDialog window] setLevel:NSModalPanelWindowLevel];
[NSApp runModalForWindow:[theDialog window]];
[theDialog showWindow:self];
return(theDialog);
}
And I have a 'go away' method:
- (IBAction)OK:(id)sender
{
[NSApp stopModal];
[self autorelease];
}
So far, all is well. Should I be doing anything else to tidy up when
the panel goes away?
Unfortunately I want to spawn a second modal dialog from this one. When
I do so it looks fine but the new window is not modal, it is possible
to click and select the first one, which is not what I want. I imagine
that I need to call [NSApp stopModal] on the first window before
calling [NSApp runModalForWindow:[theDialog window]] on the second one
- is this true? If so I need to know when the second one has gone away
so I can restore the [NSApp runModalForWindow:[theDialog window]] call
on the first window again. What I would like to do is to put the NSApp
modal on/off calls in methods that are called when the window becomes
or stops being the key window but I can't work out where this should
be. Do I need to use notifications for this?
Also, is it possible to set the window level in IB?
Thanks in advance,
Rev. Andy
_______________________________________________
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