Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
Re: if box is checked, see if panel is visible, if not, make panel visible
Posted:
Feb 22, 2013 6:26 PM
|
|
"Dustin" wrote in message <kg8hin$p5t$1@newscl01ah.mathworks.com>... > I'm pretty new to Matlab and totally new to GUI making, and need to know how to make an if statement in a checkbox function that makes a panel visible. So, if the checkbox is checked or unchecked, it checks if a specific panel is invisible or visible, and makes it visible I'm just not sure how to word it. The following code (which doesn't work since I don't know what I'm doing) should illustrate what I would like to do: > > function CheckBox1_Callback(hObject, eventdata, handles) > if Panel1 == ('Visible','off') > set(handles.PanelQ2,'Visible','on') > end > > Thanks ahead of time for the help! > Dustin
Looks like you've almost got it. The if statement should look like : if strcmp(get(Panel1,'visible'),'on')
You probably also want an outer if statement that checks if the checkbox is checked or unchecked:
if get(hObject,'value') ... end
|
|
|
|