在另一个按钮回调中调用一个按钮回调
我正在尝试在另一个按钮回调中进行按钮回调,但我遇到了问题:
这就是我想要做的:
C_N_Callback(hObject,eventdata, handles)
RN_Callback(handles, [], []);
我尝试了此操作但给出了此错误:
尝试引用非结构数组的字段。
第一步,在 RN_Callback
中执行 getappdata
。
我也尝试过这个:
C_N_Callback(hObject,eventdata, handles)
RN_Callback(hObject,eventdata, handles);
这没有给出错误,但是当我运行 GUI 时,它会继续执行 RN_Callback
中的过程(我猜刷新时)。
I am trying to pushbutton callback in an another pushbutton callback, but I am having problems:
Here is what i am trying to do:
C_N_Callback(hObject,eventdata, handles)
RN_Callback(handles, [], []);
I tried this but gave this error:
Attempt to reference field of non-structure array.
Inside RN_Callback
at first step where it is doing getappdata
.
I also tried this:
C_N_Callback(hObject,eventdata, handles)
RN_Callback(hObject,eventdata, handles);
This did not give error but when i run the GUI it keeps doing the procedure in RN_Callback
(i guess on refresh).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许
RN_Callback
正在使用对hObject
的引用。只是提醒您,hObject
是调用回调的对象。因此,在您的情况下,它将是C_N
,它将传递给RN_Callback
而不是RN
。在这种情况下,代码将是错误的,因为它需要一种类型的 GUI 对象,但得到的是另一种类型。例如:
单击
RN
将更改其字符串。但点击C_N
将更改C_N
,而不是您可能期望的RN
。Perhaps
RN_Callback
is using the reference tohObject
. Just to remind you,hObject
is the object on which the callback is being called. So in your case, it will beC_N
, which will be passed toRN_Callback
instead ofRN
.In that case, the code will be wrong, because it expects a GUI object of one type, but gets another. For example:
Clicking on on
RN
will change its string. But clicking onC_N
will changeC_N
, instead ofRN
as you might have expected.