If I change a property of a UIControl in a callback do I still need to call setappdata before exiting?

2 次查看(过去 30 天)
I start my call back with
handles = getappdata(gcf,'handles');
So I have created a local copy of the handles structure.
Then I modify a control with
set(handles.Batch,'value',1);
Since handles.batch is a handle, don't I automatically change its properties without having to call
setappdata(gcf,'handles',handles);

采纳的回答

Walter Roberson
Walter Roberson 2018-7-30
Correct, you only have to call setappdata() if you modify the structure itself.
Note: it is more common to use guidata() to manage a handles structure. It does the same thing as setappdata() of a property named UsedByGUIData_m, but people are more accustomed to reading guidata()
  1 个评论
Eugene Davis
Eugene Davis 2018-7-30
Thanks Walter. In my app, which I inherited, there are several GUI data structures. They chose not to add these other structures to the grand handles structure. I suppose all the logic, wrt guidata(), about how to deal with the handles structure apply to other structures. The main difference is that these other structures do not contain GUI handles.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by