Change in runModalForWindow: behavior between 10.4 and 10.5?
Change in runModalForWindow: behavior between 10.4 and 10.5?
- Subject: Change in runModalForWindow: behavior between 10.4 and 10.5?
- From: Chris Miner <email@hidden>
- Date: Wed, 7 Nov 2007 13:14:36 +0100
Hi all,
Are you supposed to be able to call runModalForWindow: twice for a
given same window? In 10.5 the window level gets set wrong the
second time. (not that of a modal panel)
The application that presents a list of items to the user one by one
and asks them to rate each one. After presenting one item, it calls
runModalForWindow: for the window and waits for user input. The user
input is registered, evaluated and stored, then the next item is
presented, and so on.
The user can also enable a semi-transparent dark 'screen' window to
be displayed during this activity. This is supposed to highlight the
'rating window' which is displayed on top. Under 10.4 this worked.
Under 10.5 it does not. And specifically, the second time I call
runModalForWindow: the 'rating window' is no longer displayed at the
NSModalPanelWindowLevel level but rather 0.
The net effect is that my 'rating window' is then 'screened' as
well. Here's a sample bit of code I used as an app delegate to
reproduce the problem. On 10.4 window level is always 8 in
okayAction: under 10.5 it is 8 the first time and 0 afterwards.
- (IBAction)runAction:(id)sender
{
int i;
for(i = 0; i < 10; i++) {
NSLog(@"Present Item");
int result = [NSApp runModalForWindow:window];
if (result == NSRunAbortedResponse)
break;
NSLog(@"Handle Rating");
result = [NSApp runModalForWindow:window];
if (result == NSRunAbortedResponse)
break;
}
NSLog(@"Done with session");
}
- (IBAction)okayAction:(id)sender
{
NSLog(@"Okay Clicked");
NSLog(@"Window level is: %d", [window level]);
[NSApp stopModal];
}
- (IBAction)stopAction:(id)sender
{
NSLog(@"Stop Clicked");
NSLog(@"Window level is: %d", [window level]);
[NSApp abortModal];
}
- (BOOL)windowShouldClose:(id)window
{
NSLog(@"Window should close");
return YES;
}
- (void)windowWillClose:(NSNotification *)aNotification
{
NSLog(@"Window will close.");
[NSApp abortModal];
}
_______________________________________________
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