1 | <html xmlns:saxon="http://icl.com/saxon"> |
---|
2 | <head> |
---|
3 | <link rel="stylesheet" type="text/css" href="doc.css"/> |
---|
4 | <link rel="stylesheet" type="text/css" href=""/> |
---|
5 | <meta author="The MathWorks Ltd."/> |
---|
6 | <meta copyright="2011 The MathWorks Ltd."/> |
---|
7 | <title>Visible example</title> |
---|
8 | </head> |
---|
9 | |
---|
10 | |
---|
11 | <body> |
---|
12 | <table class="header" width="100%" border="0" cellspacing="0" cellpadding="0"> |
---|
13 | <tr> |
---|
14 | <td bgcolor="#e4f0f8"><A href="User guide.html"><font face="Arial" bgcolor="#e4f0f8" size="+0" underline="0" color="#000000"><b>User guide</b></font></A></td> |
---|
15 | <td width="36" bgcolor="#e4f0f8"><A HREF="User guide3_1.html"><IMG SRC="Images/leftarrow.png" BORDER="0" ALT="previous page"/></A><A HREF="User guide4.html"><IMG SRC="Images/rightarrow.png" BORDER="0" ALT="next page"/></A></td> |
---|
16 | </tr> |
---|
17 | </table> |
---|
18 | |
---|
19 | |
---|
20 | <br clear="all"/> |
---|
21 | |
---|
22 | <h2>3.2: Visible example <a href="User guide3.html"><img src="Images/uparrow.png" border="0" align="top" alt="Go back up one level"/></a></h2> |
---|
23 | |
---|
24 | <p>(The code for this example can be found here: |
---|
25 | [ <a href="Examples/visibleexample.m">view</a> |
---|
26 | | <a href="matlab: edit(fullfile(layoutRoot,'layoutHelp','Examples','visibleexample.m'))">edit</a> |
---|
27 | | <a href="matlab: p=pwd();cd(fullfile(layoutRoot,'layoutHelp','Examples')); visibleexample; cd(p)">run</a> ] |
---|
28 | )</p> |
---|
29 | <p> |
---|
30 | This example shows how the <code>visible</code> property can be |
---|
31 | used to hide whole sections of an interface. |
---|
32 | </p> |
---|
33 | <example> |
---|
34 | <para>Open a window and add a panel</para> |
---|
35 | <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">fig = <a href="matlab:doc figure"><code class="FUNCTION">figure</code></a>( 'Name', 'Visible example', ... |
---|
36 | 'Position', [100 100 150 250], ... |
---|
37 | 'MenuBar', 'none', ... |
---|
38 | 'ToolBar', 'none', ... |
---|
39 | 'NumberTitle', 'off' ); |
---|
40 | panel = <a href="uiextras.BoxPanel.html"><code class="FUNCTION">uiextras.BoxPanel</code></a>( 'Parent', fig, 'Title', 'Panel' );</font></pre> |
---|
41 | <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/VisibleExample1.png"/></center></font></p> |
---|
42 | </example> |
---|
43 | <example> |
---|
44 | <para>Put some buttons inside the panel</para> |
---|
45 | <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">box = <a href="uiextras.VButtonBox.html"><code class="FUNCTION">uiextras.VButtonBox</code></a>( 'Parent', panel ); |
---|
46 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 1' ); |
---|
47 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 2' ); |
---|
48 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 3', 'Visible', 'off' ); |
---|
49 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 4' ); |
---|
50 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 5', 'Visible', 'off' ); |
---|
51 | <a href="matlab:doc uicontrol"><code class="FUNCTION">uicontrol</code></a>( 'Parent', box, 'String', 'Button 6' );</font></pre> |
---|
52 | <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/VisibleExample2.png"/></center></font></p> |
---|
53 | </example> |
---|
54 | <example> |
---|
55 | <para>Try hiding the panel</para> |
---|
56 | <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">set( panel, 'Visible', 'off' );</font></pre> |
---|
57 | <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/VisibleExample3.png"/></center></font></p> |
---|
58 | </example> |
---|
59 | <example> |
---|
60 | <para>Try showing the panel. Note that the original "visible" state of each button is remembered.</para> |
---|
61 | <pre style="background-color: #eeeeff; margin-left: 20px; margin-right: 20px"><font color="#000011">set( panel, 'Visible', 'on' );</font></pre> |
---|
62 | <p style="background-color: #ddddee; margin-left: 20px; margin-right: 20px"><font color="#000022"><center><img src="Images/VisibleExample2.png"/></center></font></p> |
---|
63 | </example> |
---|
64 | |
---|
65 | |
---|
66 | <br clear="ALL"/> |
---|
67 | <table class="footer" width="100%" border="0" cellspacing="0" cellpadding="0"> |
---|
68 | <tr> |
---|
69 | <td width="18" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide3_1.html"><img src="images/leftarrow.png" border="0" alt="previous page"/></a></td> |
---|
70 | <td width="40%" height="15" bgcolor="#e4f0f8" align="left"><a href="User guide3_1.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Enable example</font></a></td> |
---|
71 | <td width="20%" height="15" bgcolor="#e4f0f8" align="center"><a href="index.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">[Top]</font></a></td> |
---|
72 | <td width="40%" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide4.html"><font face="arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">Using property defaults</font></a></td> |
---|
73 | <td width="18" height="15" bgcolor="#e4f0f8" align="right"><a href="User guide4.html"><img src="images/rightarrow.png" border="0" alt="next page"/></a></td> |
---|
74 | </tr> |
---|
75 | </table> |
---|
76 | <font face="Arial" bgcolor="#e4f0f8" size="normal" underline="0" color="#000000">© 2011 The MathWorks Ltd</font> |
---|
77 | <TT>• </TT><a href="matlab: helpview([matlabroot,'/license.txt'])">Terms of Use</a> |
---|
78 | <TT>• </TT><a href="matlab: helpview([matlabroot,'/patents.txt'])">Patents</a> |
---|
79 | <TT>• </TT><a href="matlab: helpview([matlabroot,'/trademarks.txt'])">Trademarks</a> |
---|
80 | |
---|
81 | </body> |
---|
82 | </html> |
---|
83 | |
---|
84 | |
---|