How to avoid Globals on a code created (complex) Figure?
Show older comments
Dear experts,
I am creating a GUI using pure code (without Guide). When we use Guide, we have the Handles variables that it is an input of ALL Callback functions, working similarly to a Global, since the alterations on this variable are automatically considered by other callbacks, I believe the magic is in the lines:
handles.output = hObject;
guidata(hObject, handles);
added at the end of each Callback functions that modified the handles variable. Am I right? How I use something similar with my GUI project? (I am seduced by the idea of adding the Handles as Global, but I am trying to be strong here)
I already define the callback functions on my uicontrol objects, created the functions and etc. I tried to add a created "handles" variable into the MainFigure "UserData" but this does not work since neither the Figure object is recognized by the callbacks.
THANK YOU VERY MUCH IN ADVANCE!
1 Comment
"I believe the magic is in the lines:"
Magic is not involved:
Reading the documentation is involved.
Accepted Answer
More Answers (1)
Elias Gule
on 18 Jan 2018
1 vote
Categories
Find more on Graphics Object Programming in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!