
12 Examples of GUIs Created Programmatically
12-18
Defining the Callbacks
This topic defines the callbacks that service the components of the GUI.
Because the callback definitions are at a lower level than the component
definitions and the data created for the GUI, they have access to all data and
component handles.
Although the GUI has six components that are serviced by callbacks, there are
only four callback functions. This is because the
Open menu item and the Open
toolbar button share the same callbacks. Similarly, the
Print menu item
and the Print toolbar button share the same callbacks.
• “Update Button Callback” on page 12-18
• “Open Menu Item Callback” on page 12-19
• “Print Menu Item Callback” on page 12-20
• “Close Menu Item Callback” on page 12-20
Note These are the callbacks that were specified in the component
definitions, “Creating the GUI and Its Components” on page 12-12.
Update Button Callback
The hUpdateButtonCallback function services the Update push button.
Clicking the Update button triggers the execution of this callback function.
function hUpdateButtonCallback(hObject, eventdata)
% Callback function run when the Update button is pressed
localUpdatePlot();
end
The localUpdatePlot function is a helper function that plots the selected plot
type in the axes. It is defined later in the script, “Helper Function: Plotting the
Plot Types” on page 12-21.
Kommentare zu diesen Handbüchern