Execute callback between different GUIs
Show older comments
Hello everybody!
Easy question (I think)
I have two GUIs with its own buttons:
GUI_A GUI_B
I want to execute a callback in B and at then, execute the other callback in A.
Code example in GUI_B:
%
button_GUIB_callback(hObject, eventdata, handles)
code
guidata(hObject, handles);
if GUI_A still open
???execution of button_GUIA_callback
close(GUI_B)
else
msgbox('you closed the other window dude!' )
end
I was looking for the answer but I can not find exactly what I want or if is possible.
Thanks in advance
Accepted Answer
More Answers (2)
David
on 12 Jan 2012
Pass the handle to gui A into the init of gui B and then check the status of A in B.
e.g.
h = guiA;
guiB(h);
in the guiB init code you can add h to your handles -> Robert is your mothers brother.
N.B. ensure that GUIA is written such that it returns the relevant handle.
David
on 12 Jan 2012
Sorry misread what you want. Try making the callback function a separate function in its own m-script and then ensure that you pass the correct data into your callback. e.g. have guiA.m, guiB.m and guiBtnCallBack.m which contains a fcn
function guiBtnCallBack(hObj, evtData, handles)
Ensuring that gui B has sufficient data passed into it for calling this callback, then both A and B can call it.
Categories
Find more on App Building 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!