Flow of control in GUIs

1 visualización (últimos 30 días)
divya r
divya r el 3 de Abr. de 2014
Respondida: Sara el 3 de Abr. de 2014
Hi
My question is pretty rudimentary. I am unable to see the sequence in which the functions are being called in a GUI.
I realized that the OpeningFcn and the outputFcn are the first and last to be called. BUt the rest in between is very confusing.
What I want to do, is pass a path to a directory to save some data (from the main code to the GUI function) and allow the user to save the data is a push button is pressed. When I am passing it as an argument, it is stored in a variable called varargin in the GUI function. But by the time the code for the push button call back is called, the varargin variable is deleted on its own.
I am very confused about how to implement it.

Respuestas (1)

Sara
Sara el 3 de Abr. de 2014
The callback functions are called when you interact with a component in the gui. So, for instance, when you click on the pushbutton, its callback is called (if you used GUIDE, the callback is created automatically). To "save" variables in a gui you have to put them in the handles variable, e.g.:
handles.my_var = my_var;
and then use the command:
guidata(hObject, handles);
at the end of the functions called by the components in the gui (e.g., in the callback of your pushbutton, the opening function).

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by