find handle to uialert/uiconfirm windows/boxes

22 visualizaciones (últimos 30 días)
Julian Schmid
Julian Schmid el 19 de Abr. de 2020
Editada: Sean de Wolski el 10 de Sept. de 2021
Hi,
I have a problem using the uialert/uiconfirm functionality.
The short version of my question is: is there a way to find uialert/uiconfirm windows/boxes and close them programmatically if they are no longer required? I don't want to close the underlying uifigure.
The long version:
I'm currently working on a program with a GUI (using the new appdesigner/ uifigure utilities) in order to control an instrument. The setup is as following:
The instrument takes commands through the serial interface from the matlab program and executes them. The instrument has 2 buttons: one which allows to user to stop the instrument in case of an emergency and another to continue the operation. When one of these buttons is pushed the instrument state flag changes (Hold = on/off);
The program on the other side sends commands to the instrument depending on the user input. Before sending a new command, it querries the instrument state flag in order to determine whether the istrument state is Hold = off and ready to execute the next command. In case the flag changed to Hold = on, the program uses the uialert/uiconfirm functionality to notify the user and block additional input through the gui.
Once the Hold = on flag was triggered, there are two ways to disable it; eigther by pressing the instrument button or using the uialert/uiconfirm option button. If the user desides to press the instrument button, which I can monitor using a timer function querring the instrument state flag, I have the uialert window to be removed. Unfortunatly these functions do not return a handle or any other identification property which I could use to close the alert window. Do you have any idea how to work around this problem?
Thank you for your time and help in advance!
  2 comentarios
Sahithi Kanumarlapudi
Sahithi Kanumarlapudi el 22 de Abr. de 2020
Could you elaborate more on what do you mean by find uialert boxes?
Julian Schmid
Julian Schmid el 22 de Abr. de 2020
I just want to get the access to the handle of the tiny window which pops up in my uifigure window when I'm using the uialert() function. For example, with d = uiprogressdlg(f),d is the handle to the progress bar which I can use to modify or close the dialog. However, this does not work with the uialer() function, so I can't modify it once it's been created and have to wait until the user triggers the response by pressing a button.

Iniciar sesión para comentar.

Respuestas (1)

Sean de Wolski
Sean de Wolski el 22 de Abr. de 2020
Editada: Sean de Wolski el 10 de Sept. de 2021
EDIT September 2021:
In 21a you can dismiss and alert with:
Original:
I don't think it's possible to get a handle to and do what you're asking.
That being said, I question the usability of an app that has popups appearing and disappearing. I think there is probably a better way to lay this out. Perhaps with just a regular uiswitch with a corresponding uilamp showing if it's running.
  1 comentario
Julian Schmid
Julian Schmid el 22 de Abr. de 2020
Well, I was thinking of using the msgbox() function to do something like that but according to the documentation it is recommended to "To create a modal alert dialog box for single-window App Designer or uifigure-based apps, use the uialert function instead.".
I already have a lamp implemented which indicates the maschine state, but unfortunatly, there are a lot of instrument states (something I cant change) and I thought a lot of different lamp colors might put the user into trouble telling whats going on. So I thought a window with a clear message with what happend and how to fix that might be a lot more helpful.

Iniciar sesión para comentar.

Categorías

Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.

Productos


Versión

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by