【问题标题】:Is it possible to display a NSAlert/NSAlertPanel over a model window是否可以在模型窗口上显示 NSAlert/NSAlertPanel
【发布时间】:2012-08-16 08:44:06
【问题描述】:

我正在使用 runModelForWindow 显示一个模型窗口,我在这个模型窗口中有一个按钮,每当用户点击这个按钮时,我需要在不关闭模型窗口的情况下显示一个警报面板。这可能吗?我试过显示 NSAlertPanel ,它在模型窗口后面,所以用户看不到它。请给我一些建议我该怎么做?

【问题讨论】:

    标签: objective-c macos nsalert


    【解决方案1】:

    在运行警报面板之前使用以下两行后,模型窗口顶部会出现警报。

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

    NSAlert *alert = [NSAlert alertWithMessageText: @"Alert Text" 默认按钮:@“确定” 备用按钮:@“取消” 其他按钮:无 informationativeTextWithFormat:@""];

    NSInteger alertRetVal =[alert runModal];
    

    【讨论】:

      猜你喜欢
      • 2010-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-12-12
      • 1970-01-01
      • 2013-11-13
      • 1970-01-01
      相关资源
      最近更新 更多