Modal Session not stopping main thread.
Modal Session not stopping main thread.
- Subject: Modal Session not stopping main thread.
- From: Sandro Noel <email@hidden>
- Date: Wed, 24 Dec 2008 23:40:32 -0500
Greetings.
I am trying to get a modal window, to stop processing notifications
while the window is opened.
so the scenatio is,
My application received notifications that are sent from my objects
like this.
[[NSNotificationCenter defaultCenter]
postNotificationName:SERVICE_ADD_REMOVE_NOTIFICATION object:self
userInfo:service];
the application controller responds to those notifications by calling
functions that pop a modal window.
like this.
- (void) showHostPasswordWindow:(MountDefinition *) mount{
[hostPasswordWindow makeFirstResponder:hostPassword];
[hostPasswordWindow makeKeyAndOrderFront:nil];
NSModalSession session = [NSApp
beginModalSessionForWindow:hostPasswordWindow];
NSInteger response;
for (;;) {
response=[NSApp runModalSession:session];
if (response != NSRunContinuesResponse)
break;
}
if (response == NSRunStoppedResponse){
HostPassword *hPWD = [HostPassword new];
hPWD.hostName = [hostHostName stringValue];
hPWD.password = [hostPassword stringValue];
[hostPasswords addObject:hPWD];
mount.password =[hostPassword stringValue];
}
//when the user exits the window, hide the window
[NSApp endModalSession:session];
[hostPasswordWindow close];
}
the problem i am having here is that if i receive 5 notifications, i
get the same window for all the 5 notifications
but only the last one is taken into account.
what i would really need is for the application to pause while the
first notification is being processed by the user
and then pop another window, for the second notification.
i can not seem to achieve this with this code, i've tried other
approaches but they did pretty much the same thing.
can anyone tell me what I'm doing wrong here? please ?
thank you !!!
Sandro Noel.
_______________________________________________
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