MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Guia do Utilizador Página 301

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 759
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 300
Add Code for Components in C allbacks
selects the radio button with Tag property radiobutton1 and deselects the
previously selected radio button.
Note You can use a button group to m anage exclusive selection behavior for
radio buttons. See “Button Group” on page 8-42 for more information.
Check Box
You can determine the current state of a check box from within its callback by
querying the state of its
Value property. The Value property is equal to the
Max property when the check box is checked and equal to the Min property
when the check box is not checked. This example illustrates such a test.
function checkb ox1_ Callback(hObject, e vent data, handles)
if (get(hObj ect, 'Value') == get(hOb ject,'Max'))
% Checkbox is checked-take appropriate action
else
% Checkbox is not checked-take appropriate action
end
You can also change the state of a check box programmatically by setting
the check box
Value property to the value of the Max or Min property. This
example i llustrates a possible syntax for such an assignment.
maxVal = get(handles.checkbox1,'Ma x');
set(handles.checkbox1,'Value',maxVa l);
puts the check box with Tag property checkbox1 in the checked state.
Edit Text
To obtain the string a user types in an edit box, g et the String property in
the
Callback callback.
function editte xt1_ Callback(hObject, e vent data, handles)
user_string = get(hObject,'String');
% Proceed with callback
8-33
Vista de página 300
1 2 ... 296 297 298 299 300 301 302 303 304 305 306 ... 758 759

Comentários a estes Manuais

Sem comentários