SliderEditCombo

Version 1.0.1 (10,9 ko) par Todd Baxter
Combined slider and edit textbox control.
41 téléchargements
Mise à jour 16 juin 2020

Afficher la licence

Usage:

OBJ = SliderEditCombo()
OBJ = SliderEditCombo('Parent', PARENT)
OBJ = SliderEditCombo(___, 'Style', STYLE)
OBJ = SliderEditCombo(___, 'Min', MIN, 'Max', MAX, 'NumSteps', NUMSTEPS)
OBJ = SliderEditCombo(___, 'Values', VALUES)

Inputs:

PARENT (=gcf) <1x1 container handle>
- Handle to parent container (figure, uipanel, etc.) where control will be placed

STYLE (='JSlider') <character vector>
- Specify 'JSlider' or 'Slider' to create a 'javax.swing.JSlider'
control and a single edit textbox control
- Specify 'RangeSlider' to create a 'com.jidesoft.swing.RangeSlider'
control and two edit textbox controls

MIN (=0) <1x1 numeric>
- Minimum value of the range

MAX (=100) <1x1 numeric>
- Maximum value of the range

NUMSTEPS (=1000) <1x1 numeric integer>
- Number of steps to use for the slider to span the range
- Note, actual number of steps used may vary
- Used, along with MIN and MAX, to determine the uniform step size
between values for the slider

VALUES (=[]) <numeric vector>
- Specifies the only values that are selectable in the range, where
the step sizes, in general, will be non-uniform
- Note, specifying the 'Values' argument will take precedence over
specifying any of the 'Min', 'Max', or 'NumSteps' arguments

Outputs:

OBJ <1x1 SliderEditCombo object handle>
- The SliderEditCombo object provides an easy interactive and/or
programmatic way to select values in a range

Description:

SliderEditCombo will create a slider and edit textbox user interface
control, where interaction with either control will affect the state of
the other, creating the effect of one combined control. The position
of the slider "thumb" and the value displayed in the edit textbox are
synchronized. When the slider thumb position changes, the edit textbox
string is automatically updated. When a new value is entered into the
edit textbox, the slider thumb position automatically changes.

The slider thumb can be controlled by the mouse and the keyboard. When
a slider is selected/active, the right arrow, up arrow, page up, and
end keys will move the thumb higher, and the left arrow, down arrow,
page down, and home keys will move the thumb lower.

SliderEditCombo's public properties (listed below) can also be used to
programmatically set/get values and configure the control.
- 'Value' is the single slider and edit textbox value
- 'LowValue' is the low slider and edit textbox value
- 'HighValue' is the high slider and edit textbox value
- 'DisplayFormat' specifies how the numeric values will be displayed
in the edit textboxes (see 'sprintf' documentation for more details)
- 'EditTextBoxWidth' is the width of the edit textboxes in pixels
- 'Enabled' determines whether the combined slider and edit textbox
control is enabled or disabled

The SliderEditCombo object also provides an event 'ValueChanged' that
sends a notification when its value changes.

Notes:
- The combined slider and edit textbox control is sized by the parent
container, i.e. it fills the entire container.
- For the 'Slider' style control, the 'LowValue' and 'HighValue'
properties will set/get the same thing as the 'Value' property.
- For the 'RangeSlider' style control, the 'Value' property will
set/get the same thing as the 'LowValue' property.
- The 'DisplayFormat' property must be valid for displaying numeric
data, or else the SliderEditCombo object's values will not display
properly (see 'sprintf' documentation for more details).

Examples:

f = figure;
vb = uiextras.VBox('Parent', f);

% slider using min/max/step
h1 = SliderEditCombo('Parent', vb, 'Min', -10, 'Max', 10, 'NumSteps', 50);

% range slider using min/max/step
h2 = SliderEditCombo('Parent', vb, 'Style', 'RangeSlider', 'Min', 10, 'Max', 30, 'NumSteps', 100);

% slider using specified input values
values = [-20, -17, -15, -9, -6, -5, -1, 1, 2, 3, 10, 11, 13, 20];
h3 = SliderEditCombo('Parent', vb, 'Style', 'Slider', 'Values', values);

% range slider using specified input values that are highly non-uniform
values = [logspace(0, 5, 6), 1e5+(1:10)];
values = [-fliplr(values), values];
h4 = SliderEditCombo('Parent', vb, 'Style', 'RangeSlider', 'Values', values);

Requires:

GUI Layout Toolbox
HG1 version (R2014a and earlier): https://www.mathworks.com/matlabcentral/fileexchange/27758-gui-layout-toolbox
HG2 version (R2014b and later): https://www.mathworks.com/matlabcentral/fileexchange/47982-gui-layout-toolbox

Citation pour cette source

Todd Baxter (2024). SliderEditCombo (https://www.mathworks.com/matlabcentral/fileexchange/76083-slidereditcombo), MATLAB Central File Exchange. Récupéré le .

Compatibilité avec les versions de MATLAB
Créé avec R2017a
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Publié le Notes de version
1.0.1

Addressed property validation compatibility issue

1.0.0