Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

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


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

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: 629
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$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




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

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.