【问题标题】:Warning Message when someone is closing GUI in Matlab有人在 Matlab 中关闭 GUI 时的警告消息
【发布时间】:2014-01-21 15:36:48
【问题描述】:

当用户关闭 gui(使用 rght top 'x')时,如何在 GUI Matlab 中发出警告消息。

【问题讨论】:

标签: matlab user-interface warnings message


【解决方案1】:

例如,您可以set the figure's CloseRequestFcn 询问用户是否真的要关闭图窗。为此,您可以使用内置的模式窗口,例如 questdlg。上述文档中给出了example of such a function

function my_closereq(src,evnt)
% User-defined close request function
% to display a question dialog box
   selection = questdlg('Close This Figure?',...
                        'Close Request Function',...
                        'Yes','No','Yes');
   switch selection,
      case 'Yes',
         delete(gcf)
      case 'No'
         return 
   end
end

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多