Continuous slider callback, not updated handles in callback function.
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Adam
2016-6-29
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!