test_toggle.m
上传用户:zjhyt3
上传日期:2007-07-03
资源大小:89k
文件大小:1k
源码类别:

matlab例程

开发平台:

Matlab

  1. function test_toggle()
  2. % This function creates a toggle button and a text field.
  3. % The the associated callback will cause the text 
  4. % field to display the state of the toggle button.
  5. h0 = figure('Color',[0.8 0.8 0.8], ...
  6.    'Name','Test Toggle Button', ...
  7.    'NumberTitle','off', ...
  8.    'Position',[300 300 257 136], ...
  9.    'Tag','Fig1');
  10. h1 = uicontrol('Parent',h0, ...
  11.    'Units','points', ...
  12.    'BackgroundColor',[0.8 0.8 0.8], ...
  13.    'Position',[45 45 70 17], ...
  14.    'String','Off', ...
  15.    'Style','text', ...
  16.    'Tag','Label1');
  17. h1 = uicontrol('Parent',h0, ...
  18.    'Units','points', ...
  19.    'Callback','test_toggle_callback', ...
  20.    'Position',[45 25 70 17], ...
  21.    'String','Toggle Button', ...
  22.    'Style','togglebutton', ...
  23.    'Value',0, ...
  24.    'Tag','Toggle1');