How to use dialog boxes
4 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
Hope anyone can clear this up to me. Following the document:
What if I want to produce a dialog box without a figure fig below?
Or just resize the figure to be the equal to the dialog box. I've tried looking at the figure properties but found nothing about the size of the window.
Thanks!
0 件のコメント
回答 (1 件)
Rahul
2025 年 1 月 20 日
According to the steps given in the following documentation: https://it.mathworks.com/help/matlab/creating_guis/update-dialog-boxes.html
If you open a dialog box while creating an app, then the dialog box gets created within the 'uifigure' of the App.
If you require to produce the dialog box and not see the figure of the App below, you can use 'set' function on the 'Visible' property of the 'app.UiFigure'. Here is an example which I have added to a 'ButtonPushed' callback of an App:
function ButtonPushed(app, event)
set(app.UIFigure,'Visible', 'off');
e = errordlg("Operation unsuccessful","Error");
uiwait(e);
set(app.UIFigure,'Visible', 'on');
% close(app.UIFigure); Use 'close' function if the App is required to
% be closed
end
Also, a dialog box can be created without creating an App. Hence if the workflow does not require creation of an App's Figure, then dialog boxes can directly be created using functions like 'errordlg', 'warndlg' etc anywhere in a MATLAB file. Here is an example:
warndlg("This operation cannot be undone","Warning");
Refer to the following MATLAB documentations to know more:
'Figure Properties': https://www.mathworks.com/help/releases/R2022a/matlab/ref/matlab.ui.figure-properties.html
Hope this helps! Thanks.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Develop Apps Using App Designer についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!