How to use dialog boxes
Mostrar comentarios más antiguos
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!
Respuestas (1)
Rahul
el 20 de En. de 2025
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.
Categorías
Más información sobre Startup and Shutdown en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!