Question

I am displaying a model window using runModelForWindow,I have an button in this model window,whenever user clicks on this button,I need to display an alert panel without closing the model window.Is it possible?I have tried displaying NSAlertPanel,it is going behind the model window,so that user can't see it.Please give me some suggestion how can I do this?

Was it helpful?

Solution

After using the following two lines before running my alert panel brought alert on top of model window.

ProcessSerialNumber psn = {0, kCurrentProcess};
TransformProcessType(&psn, kProcessTransformToForegroundApplication);

NSAlert *alert = [NSAlert alertWithMessageText: @"Alert Text" defaultButton: @"OK" alternateButton: @"Cancel" otherButton: nil informativeTextWithFormat: @""];

NSInteger alertRetVal =[alert runModal];
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top