The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: if box is checked, see if panel is visible, if not, make panel visible
Replies: 1   Last Post: Feb 22, 2013 6:26 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View  
matt dash

Posts: 641
Registered: 4/18/08
Re: if box is checked, see if panel is visible, if not, make panel visible
Posted: Feb 22, 2013 6:26 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Dustin" wrote in message <kg8hin$p5t$>...
> 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')

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.