<< turbo | Graphics functions | validatecolor >> |
c = uicontrol() |
c = uicontrol(propertyName, propertyValue) |
c = uicontrol(parent) |
c = uicontrol(parent, propertyName, propertyValue, ...) |
uicontrol(c) |
figure graphics object.
property name: a scalar string or row vector character.
property value: a value compatible with property name.
an User Interface control object.
an User Interface control object.
c = uicontrol creates a push button, which is the default user interface control, within the current figure and returns the associated uicontrol object. If no figure is currently open, Nelson generates one using the figure function.
c = uicontrol(propertyName, propertyValue) creates a user interface control with properties defined by one or more name-value pair arguments. For instance, specifying 'Style', 'button' will create a button.
c = uicontrol(parent) creates the default user interface control (push button) within the specified parent container, rather than defaulting to the current figure.
c = uicontrol(parent, propertyName, propertyValue) creates a user interface control within the specified parent container, allowing you to define its properties using one or more name-value pair arguments.
uicontrol(c) sets the focus to a previously defined user interface control, bringing it to the forefront for user interaction.
List of properties:
BackgroundColor: Background color, specified as an RGB triplet, a hexadecimal color code, or a valid color name.
BeingDeleted: Deletion status. on/off logical value.
BusyAction: Callback queuing specified as 'queue' (default) or 'cancel'. The property determines how Nelso handles the execution of interrupting callbacks.
ButtonDownFcn: Button-press callback function
CData:An optional icon can be specified as a 3-D array of truecolor RGB values. The array values can be either: Double-precision numbers ranging from 0.0 to 1.0, or uint8 numbers ranging from 0 to 255
Callback: Primary callback function: '' (default), function handle, cell array or character vector.
Children: UIControl children: empty array.
CreateFcn: Component creation function.
DeleteFcn: Component deletion function.
Enable: Operational state of user interface control.
FontAngle: Font angle: 'italic' or 'normal' (default).
FontName: Font name: system supported font name.
FontSize: Font size: positive number.
FontUnits: Font units: 'normalized', 'inches', 'centimeters', 'pixels' or 'points' (default).
FontWeight: Font weight: 'bold' or 'normal' (default).
ForeGround: Text color, specified as an RGB triplet, a hexadecimal color code, or valid color name.
HandleVisibility: Visibility of uiControl handle.
HorizontalAlignment: Alignment of uicontrol text 'left', 'right' or 'center' (default).
Interruptible: Callback interruption 'on' (default).
KeyPressFcn: Key press callback function.
KeyReleaseFcn: Key release callback function
ListboxTop: Index of top item in list box: integer value or 1 (default).
Max: Maximum value: number or 1 (default).
Min: Minimum value: number or 0 (default).
Parent: Parent object: Figure.
Position: Location and size: [left bottom width height].
SliderStep: Slider step size: [minorstep majorstep] or [0.01 0.10] (default).
String: Text to display: character vector, cell array of character vectors or string array.
Style: 'pushbutton' (default), 'togglebutton', 'checkbox', 'radiobutton', 'edit', 'text', 'slider'.
Tooltip: Tooltip: character vector or string scalar.
Type: 'uicontrol'
UserData: User data array or [] (default).
Value: Current value: number
Visible: State of visibility: 'on' (default).
Pushbutton
f = figure;
b = uicontrol(f,'Style','pushbutton', 'String', 'Click Me', 'Position', [100 100 60 30], 'Callback', 'disp(''Hello World!'')')
Checkbox
f = figure();
h = uicontrol('Style', 'checkbox', 'String', 'Click Me!', 'Position', [100, 100, 100, 50]);
Edit
f = figure();
h = uicontrol('Style', 'edit', 'String', 'Click Me!', 'Position', [100, 100, 100, 50]);
Image
hFig = figure('Position', [100, 100, 300, 300]);
imgSize = 50; % Size of the image
[X, Y] = meshgrid(1:imgSize, 1:imgSize);
CData = cat(3, X/imgSize, Y/imgSize, zeros(imgSize));
CData = im2double(CData); % Ensure the image is of type double
hButton = uicontrol('Style', 'pushbutton', 'Position', [100, 100, 100, 100], 'CData', CData, 'String', 'Click Me!');
uicontrol demo
addpath([modulepath('graphics','root'), '/examples/uicontrol'])
edit uicontrol_demo
uicontrol_demo
uicontrol demo Interruptible
addpath([modulepath('graphics','root'), '/examples/uicontrol'])
edit uicontrol_demo_interruptible
uicontrol_demo_interruptible
figure, Managing Callback Interruptions in Nelson.
Version | Description |
---|---|
1.7.0 | initial version |
Allan CORNET