Execute callback between different GUIs
显示 更早的评论
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
采纳的回答
更多回答(2 个)
David
2012-1-12
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
2012-1-12
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.
类别
在 帮助中心 和 File Exchange 中查找有关 App Building 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!