Continuous slider callback, not updated handles in callback function.
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Joakim Magnusson
el 29 de Jun. de 2016
Comentada: Joakim Magnusson
el 30 de Jun. de 2016
I am writing a program with several gui's/windows using tabs. Therefore are all handles accessible from tha main gui/window. My addlistener is placed in a gui's (not the main gui) openingFcn where i have handles from the main gui as input argument. After addlistener is used i am adding more variables in my handles and these variables are not in handles in my continuous callback function. Why is that and is there an easy solution? Or should i try and use addlistener later in the program (can't think of a clean way to do this) when all variables have been added to handles.
0 comentarios
Respuesta aceptada
Adam
el 29 de Jun. de 2016
Passing handles around is not a good idea because it is passed by value, so as you have seen, anything added after does not come through.
You can pass the hObject of the GUI around instead and then use
handles = guidata( hObject );
I would never recommend having GUIs have such access to each other in general, but the alternative I use is too in-depth to explain if you are not familiar with Matlab OOP. I pass class objects between UIs instead and attach listeners to those. I never want a GUI listening to another GUI, I would much rather have one GUI update the properties of a shared object and another GUI listen to that shared object. It is far more robust and less prone to bugs also. But if you have never done Matlab OOP it takes more explaining than I have time for right now.
Más respuestas (0)
Ver también
Categorías
Más información sobre Interactive Control and Callbacks en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!