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

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 759
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 311
8 Programming a GUIDE GUI
Select SelectionChangeFcn from the View > View C allbacks submenu,
or
Right-click and select SelectionChangeFcn from the View Callbacks
context menu item
GUIDE places a
SelectionChangeFcn callback template at the end of the
GUI code file for you to complete.
Thefollowingexampleshowshowtocodea
SelectionChangeFcn callback. It
uses the
Tag property of the selected object to choose the appropriate code to
execute. The
Tag property of each component is a string that identifies that
component and must be unique w ithin the GUI.
function uibuttongroup1_S electionChangeFcn(hObject,eventdata)
switch get(eventda ta.NewValue,'Tag') % Get Tag of selected object.
case 'radiobutton1'
% Code for when radiobutton1 is selected.
case 'radiobutton2'
% Code for when radiobutton2 is selected.
case 'togglebutton1'
% Code for when togglebutton1 is selected.
case 'togglebutton2'
% Code for when togglebutton2 is selected.
% Continue with more cases as necessary.
otherwise
% Code for when there is no match.
end
The hObject and eventda ta arguments are available to the callback only if
the value of the callback property is specified as a function handle. See the
SelectionChangeFcn property on the Uibuttongroup Properties reference
page for information about
eventdata.Seetheuibuttongroup reference page
and “Color Palette” on page 15-51 for other examples.
Warning Do not change the nam e GUIDE assigns to a
SelectionChangeFcn callback, or you will be unable to access it when
the G UI runs.
8-44
Vista de página 311
1 2 ... 307 308 309 310 311 312 313 314 315 316 317 ... 758 759

Comentários a estes Manuais

Sem comentários