Writing callback functions for programmatical GUI with a handles argument
显示 更早的评论
Callback function handles in GUIDE take on the form:
@(hObject,eventdata)mygui('some_Callback',hObject,eventdata,guidata(hObject))
I have written function handles of this form for my programmatically created GUI, but when running them, I get the following error:
??? Error using ==> report_manager
Too many input arguments.
Error in ==>
report_manager>makeCallback/@(hObject,eventdata)mygui('some_Callback',hObject,eventdata,guidata(hObject))
??? Error while evaluating uicontrol Callback
The make callback function it's referencing looks like:
function callback = makeCallback ( callback_name )
callback = {evalin('base',['@(hObject,eventdata)mygui','(''',callback_name,''',hObject,eventdata,guidata(hObject))'])};
I have no problem in creating callbacks when they take the simple form: callback = {@fnhandle_Callback}
The problem with this is that to get the handles array, I have to have a line of code in each callback handles=guidata(hObject). What do I need to change to include the 3rd argument in my callbacks?
回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Interactive Control and Callbacks 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!