MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Spécifications Page 32

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 180
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 31
1 Getting Started with GUIDE
1-24
Example – Programming the Menu Callbacks
After adding the File menu to the layout (you cannot see the menu bar in the
Layout Editor), edit the application M-file. It will contain empty callback
functions for the
File menu as well as the Print and Close items.
File Menu Callback
By default, when a user clicks on the File menu, MATLAB displays the menu
items. Therefore, the only purpose of the
File menu callback in this example is
to disable the
Print menu item when there is no plot being displayed. You can
accomplish this by checking to see if the axes
Children property is empty (in
which case, there is nothing displayed in the axes).
The menu’s
Enable property controls whether a particular item is active or
inactive. The item is grayed out if
Enable is set to off.
The callback uses
isempty to determine if the axes contains a plot and enables
or disables the menu accordingly.
function varargout = file_menu_Callback(h, eventdata, handles, varargin)
if isempty(get(handles.axes1,'Children'))
set(handles.print_submenu,'Enable','off')
Vue de la page 31
1 2 ... 27 28 29 30 31 32 33 34 35 36 37 ... 179 180

Commentaires sur ces manuels

Pas de commentaire