How to use dialog boxes

4 ビュー (過去 30 日間)
Iacopo
Iacopo 2022 年 5 月 26 日
回答済み: Rahul 2025 年 1 月 20 日
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!

回答 (1 件)

Rahul
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:
Hope this helps! Thanks.

カテゴリ

Help Center および File ExchangeDevelop Apps Using App Designer についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by