[讨论] 请问如何更新handles给其他callback使用

楼主: InoueToro (InoueToro)   2014-06-05 13:36:53
请教网友
小弟在guidata观念可能有误...为何下方写法第二次触发不是'SayHi'?
该如何让第二次触发是'SayHi', 谢谢!
function myWork_OpeningFcn(hObject, eventdata, handles, varargin)
handles.A='Hello'
techMenu=uicontextmenu;
uimenu(techMenu,'label','myMenu','callback',{str2func('show_myMenu'), handles})
guidata(hObject, handles);
此时触发
function show_myMenu(hObject,eventdata,handles)
disp(handles.A); %会显示Hello
经过
function uitable1_CellSelectionCallback(hObject, eventdata, handles)
handles.A='SayHi';
guidata(hObject, handles);
再触发
function show_myMenu(hObject,eventdata,handles)
disp(handles.A); %依然显示Hello, 而不是'SayHi'

Links booklink

Contact Us: admin [ a t ] ucptt.com