Info
La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.
Wrong handles used in external function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hi All!
I have a Program consisting of 4 GUIs, which are opened consecutively when clicked on the respective Buttons on them. Every Gui has some fields which has to be filled out by the user. In the first GUIs Button-Callback, I initialize a 4x1 Cell, put the handles structure of GUI1 into its {1,1}-position and give it as an input argument while opening the GUI2. Afterwards I close GUI1. In the Opening Function of GUI2, I save the passed cell-array in the current handle
handles.add_handles = varargin{1};
I do this analogously with the Button-Callbacks of GUI2, GUI3 (at positions {2,1} and {3,1} respectively).
Finally, at my GUI4, i put the GUI4 handle at the {4,1}-position in the "handle-cell-array" which i have passed throughout the program so far. Now, I want to iterate over the 4 saved handles in the passed cell array and put each one into an external function as an input argument.
function weiter4_button_add_Callback(hObject, eventdata, handles)
handles.add_handles{4,1} = handles;
add_handles = handles.add_handles;
cell_array = [];
for i=1:size(add_handles,1)
curr_handles = add_handles{i,1};
curr_array = fcn_db_extract_values(curr_handles, 'add');
cell_array = [cell_array; curr_array];
end
The External Function then extracts the input of the respective GUIs via the respective handle passed into it.
The Problem: While GUI4 is open, the external function automatically takes the handles object of the current GUI, the GUI4, instead of the passed one. The handle-cell-array is correct though and the correct handles are passed into the external function each time.
In the external function, I use the command findobj(...) to find the correct input-components i want to extract the values from. All works, except it only searches the currently opened UI so i get 4 x the input of GUI4 instead of all GUIs. I Guess, the problem lies in the findobj(...) function, since it searches the current context.
How can I avoid that?
thank you in advance!
1 comentario
Geoff Hayes
el 21 de Dic. de 2016
You may want to show all of the code in your OpeningFcn so that we can see how you are updating the handles structure with input parameter and ensure that you are calling guidata correctly.
Also, are all four GUIs open simultaneously? Have you verified that the all_data is being passed successfully between GUIs?
Respuestas (0)
La pregunta está cerrada.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!