1 | %% Enabling/disabling a panel
|
---|
2 | %
|
---|
3 | % This example opens a simple user-interface with a panel full of
|
---|
4 | % buttons. We can then enable/disbale the entire panel in one go. Note
|
---|
5 | % that the previous state of the buttons is preserved.
|
---|
6 |
|
---|
7 | %% Open a window and add a panel
|
---|
8 | fig = figure( 'Name', 'Enable example', ...
|
---|
9 | 'Position', [100 100 150 250], ...
|
---|
10 | 'MenuBar', 'none', ...
|
---|
11 | 'ToolBar', 'none', ...
|
---|
12 | 'NumberTitle', 'off' );
|
---|
13 | panel = uiextras.BoxPanel( 'Parent', fig, 'Title', 'Panel' );
|
---|
14 |
|
---|
15 | %% Put some buttons inside the panel
|
---|
16 | box = uiextras.VButtonBox( 'Parent', panel );
|
---|
17 | uicontrol( 'Parent', box, 'String', 'Button 1' );
|
---|
18 | uicontrol( 'Parent', box, 'String', 'Button 2' );
|
---|
19 | uicontrol( 'Parent', box, 'String', 'Button 3', 'Enable', 'off' );
|
---|
20 | uicontrol( 'Parent', box, 'String', 'Button 4' );
|
---|
21 | uicontrol( 'Parent', box, 'String', 'Button 5', 'Enable', 'off' );
|
---|
22 | uicontrol( 'Parent', box, 'String', 'Button 6' );
|
---|
23 |
|
---|
24 | %% Try disabling the panel
|
---|
25 | set( panel, 'Enable', 'off' );
|
---|
26 |
|
---|
27 | %% Try enabling the panel
|
---|
28 | set( panel, 'Enable', 'on' ); |
---|