get handle of an running gui

32 visualizaciones (últimos 30 días)
Adrian
Adrian el 18 de Sept. de 2013
Respondida: Róbert Kakonyi el 17 de Jul. de 2019
Hi,
I have a GUI (GUI2) and want to get the handle of another one (GUI1) which is already running behind the actuall GUI-Window. If I use GUI1handle = guidata(GUI1) I get the handle but the Window behind opens again. How can I solve this?
  2 comentarios
Frank Herzog
Frank Herzog el 19 de Jul. de 2018
The accepted answer to this question does not work for versions R2017a and R2017b. The return value of both calls is a '0x0 empty GraphicsPlaceholder array', i.e., not a handle to the gui window.
How can I obtain a valid handle to a gui window in R2017a or R2017b?
Dennis
Dennis el 19 de Jul. de 2018
The first call can only work if you actually set a tag to your figure/object.
The 2nd works without any problem for me (2017b).
You could aswell just store and pass the handle when you create your figure.
It might also be a good idea to open a new question - this one is 5 years old and probably does not receive too much attention nowadays.

Iniciar sesión para comentar.

Respuesta aceptada

Walter Roberson
Walter Roberson el 18 de Sept. de 2013
Possibly
findobj(0, 'tag', 'GUI1')
or
findobj(0, 'type', 'figure')
and exclude from that the figure(s) associated with GUI2.
  3 comentarios
Walter Roberson
Walter Roberson el 20 de Jul. de 2018
Both approaches work in HG2.
However, if you are using GUIDE then the handle visibility of your GUI might be set to 'callback'. If it is, then you will need to use findall() instead of findobj()
Frank Herzog
Frank Herzog el 24 de Jul. de 2018
Using findall() instead of findobj() solved the problem. Thanks!

Iniciar sesión para comentar.

Más respuestas (1)

Róbert Kakonyi
Róbert Kakonyi el 17 de Jul. de 2019
>> hGUI = findobj(0)
>> hGUI.ShowHiddenHandles = true
>> hGUI = findobj(0)
hGUI =
236×1 graphics array:
Root
Figure (figure1)
UIControl (text171)
UIControl (pb_input_data)
UIControl (pb_skizze_vor
... and a lot more.
>> hfig = hGUI(2);
>> hfig.delete;
This will delete the seemingly locked object.

Categorías

Más información sobre Migrate GUIDE Apps en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by