MATLAB SIMULINK 7 - GRAPHICAL USER INTERFACE Manual de usuario Pagina 183

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 330
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 182
Callback Syntax and Arguments
8-11
Callback Syntax and Arguments
GUIDE defines conventions for callback syntax and arguments and
implements these conventions in the callback templates it adds to the M-file.
Each template is similar to this one for the
Callback subfunction for a push
button.
% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles) %#ok
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
...
The first comment line describes the event that triggers execution of the
callback. This is followed by the function definition line. The remaining
comments describe the input arguments.
Insert your code after the last comment.
Note You can avoid automatic generation of the callback comment lines for
new callbacks. In the
Preferences dialog box, select GUIDE and uncheck Add
comments for newly generated callback functions.
This topic discusses these aspects of the template:
“Naming of Callback Functions” on page 8-11
“Changing Callback Names Assigned by GUIDE” on page 8-12
“Input Arguments” on page 8-13
“The Handles Structure” on page 8-13
Naming of Callback Functions
The callback example above shows the following function definition:
function pushbutton1_Callback(hObject,eventdata,handles)
Vista de pagina 182
1 2 ... 178 179 180 181 182 183 184 185 186 187 188 ... 329 330

Comentarios a estos manuales

Sin comentarios