
Icon Editor
12-41
1 processUserInputs sequences through the inputs, if any, and tries to match
each property name to a string in the first column of the
mPropertyDefs cell
array.
2 If it finds a match, processUserInputs assigns the value that was input for
the property to its variable in the third column of the
mPropertyDefs cell
array.
3 processUserInputs then calls the helper function specified in the second
column of the
mPropertyDefs cell array to validate the value that was
passed in for the property.
Retrieving Output on Return from a GUI
If you call iconEditor with an output argument, it returns a truecolor image
as an n-by-m-by-3 array.
The data definition section of the M-file creates a cell array to hold the output:
mOutputArgs = {}; % Variable for storing output when GUI returns
Following the call to uiwait, which stops the sequential execution of the M-file,
iconEdit assigns the constructed icon array,
mIconEdit, to the cell array
mOutputArgs and then assigns mOutputArgs to varargout to return the
arguments.
mOutputArgs{} =mIconCData;
if nargout>0
[varargout{1:nargout}] = mOutputArgs{:};
end
This code is the last that iconEditor executes before returning. It executes only
after clicking the
OK or Cancel button triggers execution of
hOKButtonCallback or hCancelButtonCallback, which call uiresume to
resume execution.
Protecting a GUI from Inadvertent Access
The prepareLayout utility function protects the iconEditor from inadvertently
being altered from the command line by setting the
HandleVisibility
properties of all the components. The iconEditor calls
prepareLayout with the
handle of the main figure, in the initialization section of the M-file.
% Make changes needed for proper look and feel and running on
Comentários a estes Manuais