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?

有帮助吗?

解决方案

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];
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top