MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Especificações Página 128

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 216
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 127
4 Programming GUIs
4-8
Programming Callbacks for GUI Components
This section explains how to program the callbacks for some specific GUI
components. “Callback Properties” on page 3-51 describes the different kinds
of callbacks.
See a component’s property reference page to determine which callbacks apply
for that component. “Setting Component Properties — The Property Inspector”
on page 3-40 provides links to the property reference pages.
This section provides information on the following topics:
“Toggle Button Callback” on page 4-8
“Radio Buttons” on page 4-9
“Check Boxes” on page 4-10
“Edit Text” on page 4-10
“Sliders” on page 4-11
“List Boxes” on page 4-11
“Pop-Up Menus” on page 4-12
“Panels” on page 4-13
“Button Groups” on page 4-13
“Axes” on page 4-14
“ActiveX Controls” on page 4-17
“Figures” on page 4-24
Toggle Button Callback
The callback for a toggle button needs to query the toggle button to determine
what state it is in. MATLAB sets the
Value property equal to the Max property
when the toggle button is depressed (
Max is 1 by default) and equal to the Min
property when the toggle button is not depressed (
Min is 0 by default).
From the GUI M-file
The following code illustrates how to program the callback in the GUI M-file.
function togglebutton1_Callback(hObject, eventdata, handles)
button_state = get(hObject,'Value');
if button_state == get(hObject,'Max')
Vista de página 127
1 2 ... 123 124 125 126 127 128 129 130 131 132 133 ... 215 216

Comentários a estes Manuais

Sem comentários