How to use dialog boxes

8 views (last 30 days)
Iacopo
Iacopo on 26 May 2022
Answered: Rahul on 20 Jan 2025 at 9:25
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!

Answers (1)

Rahul
Rahul on 20 Jan 2025 at 9:25
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.

Categories

Find more on Develop Apps Using App Designer in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!