CW_FSLIDER
The CW_FSLIDER function creates a slider that selects floating-point values.
This routine is written in the IDL language. Its source code can be found in the file cw_fslider.pro
in the lib
subdirectory of the IDL distribution.
Using CW_FSLIDER
To get or set the value of a CW_FSLIDER widget, use the GET_VALUE and SET_VALUE keywords to WIDGET_CONTROL.
Note: The CW_FSLIDER widget is based on the WIDGET_SLIDER routine, which accepts only integer values. Because conversion between integers and floating-point numbers necessarily involves round-off errors, the slider value returned by CW_FSLIDER may not exactly match the input value, even when a floating-point number is entered in the slider’s text field as an ASCII value. For more information on floating-point issues, see Accuracy and Floating Point Operations.
Syntax
Result = CW_FSLIDER( Parent [, /DOUBLE] [, /DRAG] [, /EDIT] [, FORMAT=string] [, /FRAME] [, MAXIMUM=value] [, MINIMUM=value] [, SCROLL=units] [, /SUPPRESS_VALUE] [, TAB_MODE=value] [, TITLE=string] [, UNAME=string] [, UVALUE=value] [, VALUE=initial_value] [, XSIZE=length | {, /VERTICAL [, YSIZE=height]}] )
Return Value
This function returns the widget ID of the newly-created slider widget.
Arguments
Parent
The widget ID of the parent widget.
Keywords
DOUBLE
Set this keyword to return double-precision values in the VALUE field of widget events generated by CW_FSLIDER. Explicitly set DOUBLE=0 to ensure that values returned in the VALUE field are single-precision. By default, CW_FSLIDER will return double-precision values if any of the values specified by the MINIMUM, MAXIMUM, or VALUE keywords is double-precision, or single-precision otherwise.
Note: The value returned by the GET_VALUE keyword to WIDGET_CONTROL is the value contained in the VALUE field of the widget event structure.
DRAG
Set this keyword to cause events to be generated continuously when the slider is adjusted. The default is DRAG=0, in which case events are generated only when the mouse is released. Note that on slow systems, /DRAG performance can be inadequate.
EDIT
Set this keyword to make the slider label editable. The default is EDIT=0. If EDIT is set, the GET_VALUE keyword to WIDGET_CONTROL will return the value of the slider label if it has been changed.
Note: If the user edits the slider label but does not press Enter, the slider position will not be updated to the new value. In this case, the widget programmer is responsible for using GET_VALUE to retrieve the new value of the slider label, followed by SET_VALUE to set the new value and update the slider position.
FORMAT
Provides the format in which the slider value is displayed. This should be a format as accepted by the STRING procedure. The default FORMAT is '(G13.6)'
FRAME
Set this keyword to have a frame drawn around the widget. The default is FRAME=0.
MAXIMUM
The maximum value of the slider. The default is MAXIMUM=100.
MINIMUM
The minimum value of the slider. The default is MINIMUM=0.
SCROLL
Set the SCROLL keyword to a floating-point value specifying the number of floating-point units the scroll bar should move when the user clicks the left mouse button inside the slider area (Motif) or on the slider arrows (Windows), but not on the slider itself. The default on both platforms is 0.01 x (MAXIMUM - MINIMUM), which is 1% of the slider range.
SUPPRESS_VALUE
If this keyword is set, the current slider value is not displayed.
TAB_MODE
Set this keyword to one of the values shown in the table below to determine how the widget hierarchy can be navigated using the Tab key. The TAB_MODE setting is inherited by lower-level bases and child widgets unless it is explicitly set on an individual widget.
Note: It is not possible to tab to disabled (SENSITIVE=0) or hidden (MAP=0) widgets.
Valid settings are:
Value |
Description |
0 |
Disable navigation onto or off of the widget. This is the default. Child widgets automatically inherit the tab mode of the parent base as described in Inheriting the TAB_MODE Value. |
1 |
Enable navigation onto and off of the widget. |
2 |
Navigate only onto the widget. |
3 |
Navigate only off of the widget. |
Note: In widget applications on the UNIX platform, the Motif library controls what widgets are brought into and released from focus using tabbing. The TAB_MODE keyword value is always zero, and any attempt to change it is ignored when running a widget application on the UNIX platform. Tabbing behavior may vary significantly between UNIX platforms; do not rely on a particular behavior being duplicated on all UNIX systems.
TITLE
Set this keyword to a string defining the title of the slider.
Note: You can use language catalogs to internationalize this value with strings in particular languages.
UNAME
Set this keyword to a string that can be used to identify the widget in your code. You can associate a name with each widget in a specific hierarchy, and then use that name to query the widget hierarchy and get the correct widget ID.
To query the widget hierarchy, use the WIDGET_INFO function with the FIND_BY_UNAME keyword. The UNAME should be unique to the widget hierarchy because the FIND_BY_UNAME keyword returns the ID of the first widget with the specified name.
UVALUE
The “user value” to be assigned to the widget.
VALUE
The initial floating-point numeric value of the slider.
VERTICAL
If set, the slider will be oriented vertically. The default is horizontal.
XSIZE
The length of horizontal sliders.
YSIZE
The height of vertical sliders.
Keywords to WIDGET_CONTROL and WIDGET_INFO
The widget ID returned by most compound widgets is actually the ID of the compound widget’s base widget. This means that many keywords to the WIDGET_CONTROL and WIDGET_INFO routines that affect or return information on base widgets can be used with compound widgets.
You can use the GET_VALUE and SET_VALUE keywords to WIDGET_CONTROL to obtain or set the value of the slider. In addition, you can use the SET_VALUE keyword to change the minimum and maximum values of the slider by setting the keyword equal to a three-element vector [value, min, max].
Note: The SET_SLIDER_MAX and SET_SLIDER_MIN keywords to WIDGET_CONTROL and the SLIDER_MIN_MAX keyword to WIDGET_INFO do not work with floating point sliders created with CW_FSLIDER.
See Creating a Compound Widget for a more complete discussion of controlling compound widgets using WIDGET_CONTROL and WIDGET_INFO.
Widget Events Returned by the CW_FSLIDER Widget
CW_FSLIDER generates an event that specifies the current value of the slider and a flag specifying whether events are generated as the slider is dragged. This widget generates event structures with the following definition:
Event = { ID:0L, TOP:0L, HANDLER:0L, VALUE:0.0, DRAG:0}
The VALUE field is the floating-point value selected by the slider. The DRAG field reports on whether events are generated continuously (when the DRAG keyword is set) or only when the mouse button is released (the default).
Version History
Pre 4.0 |
Introduced |
6.1 |
Added TAB_MODE keyword |