On May 14, 2010, at 12:13 AM, kirankumar wrote:
I am developing one application in that i want to add device request feature ,for that i am sending a message like "DeviceRequest" . if this message is send to other pc in that pc it shows one Alert message (NSRunAlertPanel(@"Request",@"Please Disconnect the device",@"ok",@"",nil); But again i am sending a devicerequest ,at that time first message will display like that only untill i click on Ok button. my question is i want to terminate the first message when second message appears.
Short answer: there's no way to cancel NSRunAlertPanel or NSAlert without user action.
In general you should ignore or queue up messages that arrive while the runloop is in the NSModalPanelRunLoopMode. (Ignoring is better, since if you queue up a ton of messages, the user gets one alert panel after another with no way to escape.)
If you absolutely have to have an alert panel that you can dismiss automatically, build your own using a nib. It's not hard; NSAlert is just a convenience. But this is IMHO a bad UI because it can confuse the user to have a window disappear right as s/he was about to click in it, possibly causing an accidental click in the window below.
—Jens_______________________________________________ Cocoa-dev mailing list ([email protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
