From: Dave Muench on 6 Apr 2010 17:23 Hi Folks: Getting back into GUIDE and I'm trying to figure out how to update button properties. Say I click on a radio button that represents a user option, then I would like to change the text color of another button (say from grey to black), and enable that button (make it active). Any thoughts? I can update the radio button properties, but I can't figure how to get the other button's properties to update within the radio button callback. Much appreciated Dave Greenville, SC
From: ImageAnalyst on 6 Apr 2010 17:27 Dave Muench: It's easy. Just refer to it by it's full handle tag. So in the radio button callback, you'd put this set(handle.btnGo, 'String', 'Process files with the XXXXXX option'); which will set the text on the btnGo button to what I said. Or something similar with the other controls. set(handles.sldScrollBar, 'Value', 10); etc. The key thing is to use the full name of the tag of the control you want to affect after the set(. Good luck, ImageAnalyst
From: Dave Muench on 7 Apr 2010 08:38 Thanks ImageAnalyst. For some reason your suggestion works when updating the string property, but how about updating something like the text color, via the 'ForegroundColor' property? That is what I'm struggling with at the moment. For example: function dynEventsFileButton_Callback(hObject, eventdata, handles) % hObject handle to dynEventsFileButton (see GCBO) % eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) % the line below works fine for the dynEventsFileButton: set(handles.dynEventsFileButton,'ForegroundColor', [1 0 0]); %And the line below will change the string for pushbutton2 set(handles.pushbutton2,'String','TestChange'); %However, the line below will not change the pushbutton foreground color set(handles.pushbutton2,'ForegroundColor',[1 0 0]); Is there a distinction I must make amongst various button properties? Thanks again, Dave ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <360b519d-74a9-44d8-9e66-5ad4e742b30f(a)v16g2000vba.googlegroups.com>... > Dave Muench: > It's easy. Just refer to it by it's full handle tag. So in the radio > button callback, you'd put this > > set(handle.btnGo, 'String', 'Process files with the XXXXXX option'); > > which will set the text on the btnGo button to what I said. > > Or something similar with the other controls. > set(handles.sldScrollBar, 'Value', 10); > etc. > The key thing is to use the full name of the tag of the control you > want to affect after the set(. > > Good luck, > ImageAnalyst
|
Pages: 1 Prev: Matlab Compiler; Speed advantage? Next: transition probability matrix |