문제

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