Prev: Test the existence of a variable
Next: FYI: Need to install MS VC 2005 redistributable when using matlab compiler/component runtime
From: BrianS on 4 Nov 2009 16:56 I am using Guide to build my GUI with UIButtonGroup's. I can right click and select the Callback/SelectionChangeFcn to get the code block added to the associated .m file but the actual SelectionChangeFcn for the UIButtonGroup is not set. What is the best way to set the SelectionChangeFcn? I suspect that it is in the OpeningFcn callback but I can't seem to get the syntax correct. I think it should be: set(handles.group1,'SelectionChangeFcn','gui1 (''group1_SelectionChangeFcn'',get(get (gco,'''parent''),''SelectedObject''),eventdata,guidata(gcbo))') but the eventdata is undefined when the callback is called. Why won't Mathworks generate the SelectionChangeFcn callback automatically generated like all the other callbacks for other uicontrols and visible in the Property Inspector? Thanks!
From: BrianS on 5 Nov 2009 11:47
On Nov 4, 4:56 pm, BrianS <bser...(a)gmail.com> wrote: > I am using Guide to build my GUI with UIButtonGroup's. I can right > click and select the Callback/SelectionChangeFcnto get the code block > added to the associated .m file but the actualSelectionChangeFcnfor > the UIButtonGroup is not set. > > What is the best way to set theSelectionChangeFcn? I suspect that it > is in the OpeningFcn callback but I can't seem to get the syntax > correct. I think it should be: > > set(handles.group1,'SelectionChangeFcn','gui1 > (''group1_SelectionChangeFcn'',get(get > (gco,'''parent''),''SelectedObject''),eventdata,guidata(gcbo))') > > but the eventdata is undefined when the callback is called. > > Why won't Mathworks generate theSelectionChangeFcncallback > automatically generated like all the other callbacks for other > uicontrols and visible in the Property Inspector? > > Thanks! OK, figured it out......the doc's were not very clear to me. By right clicking and selecting View Callbacks/SelectionChangeFcn it automatically sets the callback. I thought that it only placed the code in the guide .m. |