Appdesigner - Appearance of second window similar to uialert
3 views (last 30 days)
I am currently working on small GUI via appdesigner. The app basically consists of a main window and a dialog, that is sometimes called from the main app after processing some data. I created both windows via appdesigner in two seperate .mlapp files. So both apps work, the calling from the dialog by the main app too.
However I now want to change a bit the behavior/appearance of the dialog window. Currently it is just appearing as a seperate windows next to my mainwindow. However I like the appearence e.g. uialert uses. So I want the dialog to appear in the middle of my mainwindow, with the mainwindow beeing colored in dark gray, with some transparency. When just opening an uialert window this is just passing the app.UIFigure of the mainapp to uialert(). Is there a simple way I can achieve this with my appdesigner dialog?
Pavan Guntha on 3 Sep 2021
A possible workaround might be to design the dialog app using 'dialog' function instead of developing a MATLAB App because 'dialog' function helps to create pop up dialogues and allows us to control its position when popped out from the main app. To make the main window greyed out when the dialog is opened, you could make use of the following command:
set(app.UIFigure.Children, 'Enable', 'off');
The attached example MATLAB App illustrates the idea. The main app looks as follows:
Upon clicking the Enter Colors button, a dialog app pops up and asks the user to choose a color. The main app now gets greyed out (buttons and EditField get disabled).
For more details on 'dialog' function you could have a look at this documentation page.
Hope this helps!