سؤال

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