フィルターのクリア

Dialog box when try to close GUI window

6 ビュー (過去 30 日間)
Muaaman
Muaaman 2014 年 12 月 15 日
コメント済み: Muaaman 2014 年 12 月 15 日
I created a GUIDE GUI, but I want to prompt the user to a choice dialog box if they try to close the GUI window using the Close button (i.e. that button which is typically an "X" on PC, and typically a red circle on Mac).
How may I go about editing the GUIDE GUI .m default code to implement this? Input would be much appreciated.

採用された回答

Adam
Adam 2014 年 12 月 15 日
Right click on your main figure in GUIDE and select View Callbacks->CloseRequestFcn.
There is an example of what to do inside this function at:
if you search for CloseRequestFcn.
Most important is that you must call delete( gcf ) otherwise the figure will never close because you are over-riding default close behaviour.
Personally I don't use 'gcf', I get the figure handle explicitly, but that example uses 'gcf' so I guess it is fine.
  1 件のコメント
Muaaman
Muaaman 2014 年 12 月 15 日
Thank you Adam. This helped.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeMigrate GUIDE Apps についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by