Slider(3W) UNIX System V Slider(3W)
NAME
Slider - sets a numeric value and gives a visual indication of the
setting range
SYNOPSIS
#include <Intrinsic.h>
#include <StringDefs.h>
#include <OpenLook.h>
#include <Slider.h>
widget = XtCreateWidget(name, sliderWidgetClass, ...)
DESCRIPTION
Slider Components
The Slider widget implements a simple control used to change a numeric
value. It consists of the following elements:
- Top (Left) Anchor (optional)
- Bottom (Right) Anchor (optional)
- Drag Box
- Bar (typically)
- Shaded Bar (typically)
- Current Value (not visible)
- Minimum Value (not visible)
- Minimum Value Label (optional)
- Maximum Value (not visible)
- Maximum Value Label (optional)
- Tick Marks (optional)
The Current Value is the numeric value a user attempts to change with the
Slider widget.
Figure 1. Horizontal Slider
10/89 Page 1
Slider(3W) UNIX System V Slider(3W)
Figure 2. Vertical Slider
Drag Box Motion
As visual feedback to the user, the Drag Box moves up or down (or left or
right) along the Bar as the Current Value changes.
Dragging SELECT
The user can change the Current Value by dragging the Drag Box with
SELECT. The pressing of SELECT must start with the pointer in the Drag
Box, but the Drag Box (and the Current Value) track the pointer motion
regardless of where it goes while SELECT is pressed. This means it is
not possible for the user to change the Current Value by first pressing
SELECT outside the Drag Box and then moving the pointer into it. Only
the component of the pointer motion parallel to the Bar is tracked, and
the motion of the Drag Box (and change in the Current Value) are limited
by the length of the Bar.
Clicking SELECT
Clicking SELECT above the Drag Box for a vertical slider, or to the right
for a horizontal slider, increases the Current Value by an application-
specified amount, moves the Drag Box to correspond to the new Current
Value, and moves the pointer to keep it on the Drag Box. Clicking SELECT
to the other side of the Drag Box decreases the value by the same amount
and moves the Drag Box and pointer accordingly. Pressing SELECT repeats
this action.
Moving Drag Box to Limits
Clicking SELECT on one of the Bottom/Left or Top/Right Anchors causes the
Current Value to take on the Minimum Value or Maximum Value,
respectively, and moves the Drag Box to the limit in the direction of the
Anchor. If the Drag Box is already at the limit, nothing happens.
Clicking SELECT on an Anchor highlights the Anchor while the Current
Value is changed.
Application Notification
The application finds out about a change in the Current Value on the
release of SELECT for either the drag or click. It is responsible for
providing any feedback to the end user deemed appropriate, such as
updating the Current Value in a text field.
Coloration
When the Slider widget receives the input focus through keyboard
traversal, the background color of the widget changes to the input focus
color, found in the resource XtNinputFocusColor. If the user traverses
out of the Slider widget, the background of the widget shall revert to
its original background color.
EXCEPTION:
Page 2 10/89
Slider(3W) UNIX System V Slider(3W)
If the input focus color is the same as either the foreground or
background color, then the widget shows input focus by switching the
background and foreground colors.
Figure 3 illustrates the resources that affect the coloration of the
Slider widget.
Figure 3. Slider Coloration
Keyboard Traversal
The Slider's default values of the XtNtraversalOn resource is True.
The user can operate the Slider by using the keyboard to move the Drag
Box and access the Anchors. The following keys manipulate the Current
Value:
- SCROLLUP and SCROLLRIGHT increase the Current Value by an application-
specified amount, and moves the Drag Box to correspond to the new
Current Value.
- SCROLLDOWN and SCROLLLEFT decrease the Current Value by an application-
specified amount, and moves the Drag Box to correspond to the new
Current Value.
- SCROLLTOP and SCROLLRIGHTEDGE cause the Current Value to take on the
Maximum Value, and moves the Drag Box to a vertical slider's top anchor
or a horizontal slider's right anchor. The anchor is briefly
highlighted while the Current Value is changed and the Drag Box is
moved.
- SCROLLBOTTOM and SCROLLLEFTEDGE cause the Current Value to take on the
Minimum Value, and moves the Drag Box to a vertical slider's bottom
anchor or a horizontal slider's left anchor. The anchor is briefly
highlighted while the Current Value is changed and the Drag Box is
moved.
_________________________________________________________________________
| Vertical Slider Activation Types |
|____________________________|___________________________________________|
| Activation Type | Expected Results |
|____________________________|___________________________________________|
| OL_SCROLLUP | Drag Box moves up one Unit |
| OL_SCROLLDOWN | Drag Box moves down one Unit |
| OL_SCROLLTOP | Drag Box moves to top anchor |
| OL_SCROLLBOTTOM | Drag Box moves to bottom |
| | anchor |
|____________________________|___________________________________________|
_________________________________________________________________________
Horizontal Slider Activation Types
10/89 Page 3
Slider(3W) UNIX System V Slider(3W)
_________________________________________________________________________
| Horizontal Slider Activation Types |
|_____________________________|__________________________________________|
| Activation Type | Expected Results |
|_____________________________|__________________________________________|
|_____________________________|__________________________________________|
| Activation Type | Expected Results |
|_____________________________|__________________________________________|
| OL_SCROLLRIGHT | Drag Box moves right one Unit |
| OL_SCROLLLEFT | Drag Box moves left one Unit |
| OL_SCROLLRIGHTEDGE | Drag Box moves to right anchor |
| OL_SCROLLLEFTEDGE | Drag Box moves to left anchor |
|_____________________________|__________________________________________|
The Slider widget responds to the following keyboard navigation keys:
- NEXT_FIELD, MOVEDOWN, and MOVERIGHT move to the next traversable widget
in the window
- PREV_FIELD, MOVEUP, and MOVELEFT move to the previous traversable widget
in the window
- NEXTWINDOW moves to the next window in the application
- PREVWINDOW moves to the previous window in the application
- NEXTAPP moves to the first window in the next application
- PREVAPP moves to the first window in the previous application
Display of Keyboard Mnemonic
The Slider does not display the mnemonic accelerator. If the Slider is
the child of a Caption widget, the Caption widget will display the
mnemonic as part of the label.
Display of Keyboard Accelerators
The Slider does not respond to a keyboard accelerator because clicking
the SELECT button on a Slider activates depending on the pointer
position. So, the Slider does not display a keyboard accelerator.
RESOURCES
____________________________________________________________________________________________
| Slider Resource Set |
|_____________________|______________________|________________|____________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|____________________|________|
____________________________________________________________________________________________
XtNaccelerator XtCAccelerator String NULL SGI
____________________________________________________________________________________________
XtNacceleratorText XtCAcceleratorText String Dynamic SGI
____________________________________________________________________________________________
XtNancestorSensitive XtCSenstitive Boolean TRUE G*
____________________________________________________________________________________________
Page 4 10/89
Slider(3W) UNIX System V Slider(3W)
____________________________________________________________________________________________
| Slider Resource Set (cont'd) |
|_____________________|______________________|________________|____________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|____________________|________|
XtNbackground XtCBackground Pixel White SGI†
____________________________________________________________________________________________
XtNbackgroundPixmap XtCPixmap Pixmap (none) SGI†
____________________________________________________________________________________________
XtNconsumeEvent XtCConsumeEvent XtCallbackList NULL SGI
____________________________________________________________________________________________
XtNdestroyCallback XtCCallback XtCallbackList NULL SI
____________________________________________________________________________________________
XtNdragCBType XtCDragCBType OlDefine OL_CONTINUOUS SGI
____________________________________________________________________________________________
XtNendBoxes XtCEndBoxes Boolean TRUE SGI
____________________________________________________________________________________________
XtNfont XtCFont FontStruct * (OPENLOOK default) SGI
____________________________________________________________________________________________
XtNfontColor XtCFontColor Pixel foreground SGI
____________________________________________________________________________________________
XtNforeground XtCForeground Pixel Black SGI†
____________________________________________________________________________________________
XtNgranularity XtCGranularity int 1 SGI
____________________________________________________________________________________________
XtNheight XtCHeight Dimension (calculated) SGI
____________________________________________________________________________________________
XtNinitialDelay XtCInitialDelay int 500 SGI
____________________________________________________________________________________________
XtNinputFocusColor XtCInputFocusColor Pixel Black SGI
____________________________________________________________________________________________
XtNmappedWhenManaged XtCMappedWhenManaged Boolean TRUE SGI
____________________________________________________________________________________________
XtNminLabel XtCLabel String NULL SGI
____________________________________________________________________________________________
XtNmaxLabel XtCLabel String NULL SGI
____________________________________________________________________________________________
XtNmnemonic XtCMnemonic unsigned char NULL SGI
____________________________________________________________________________________________
XtNorientation XtCOrientation OlDefine OL_VERTICAL GI
____________________________________________________________________________________________
XtNrecomputeSize XtCRecomputeSize Boolean FALSE SGI
____________________________________________________________________________________________
XtNreferenceName XtCReferenceName String NULL SGI
____________________________________________________________________________________________
XtNreferenceWidget XtCReferenceWidget Widget NULL SGI
____________________________________________________________________________________________
XtNrepeatRate XtCRepeatRate int 100 SGI
____________________________________________________________________________________________
XtNsensitive XtCSensitive Boolean TRUE GI*
____________________________________________________________________________________________
XtNsliderMax XtCSliderMax int 100 SGI
10/89 Page 5
Slider(3W) UNIX System V Slider(3W)
____________________________________________________________________________________________
| Slider Resource Set (cont'd) |
|_____________________|______________________|________________|____________________|________|
| Name | Class | Type | Default | Access|
|_____________________|______________________|________________|____________________|________|
|_____________________|______________________|________________|____________________|________|
| XtNsliderMin | XtCSliderMax | int | 0 | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNsliderMoved | XtCCallback | XtCallbackList| NULL | SI |
|_____________________|______________________|________________|____________________|________|
| XtNsliderValue | XtCSliderValue | int | 0 | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNspan | XtCSpan | Dimension | OL_IGNORE | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNstopPosition | XtCStopPosition | OlDefine | OL_ALL | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNticks | XtCTicks | int | 0 | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNtickUnit | XtCTickUnit | OlDefine | OL_NONE | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNtraversalOn | XtCTraversalOn | Boolean | TRUE | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNuserData | XtCUserData | XtPointer | NULL | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNwidth | XtCWidth | Dimension | (calculated) | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNx | XtCPosition | Position | 0 | SGI |
|_____________________|______________________|________________|____________________|________|
| XtNy | XtCPosition | Position | 0 | SGI |
|_____________________|______________________|________________|____________________|________|
XtNendBoxes
This resource selects the display of the end boxes.
XtNforeground
This resource defines the foreground color for the widget.
See the note about the interaction of this resource with other color
resources under the description of the XtNbackground resource in Section
2, Core Resources.
XtNgranularity
Range of Values:
1 < XtNgranularity < (XtNsliderMax - XtNsliderMin)
Clicking SELECT on the Bar or Shaded Bar attempts to change the Current
Value by the amount given in this resource. Dragging the Drag Box with
SELECT changes the Current Value by this amount before the XtNsliderMoved
callbacks are issued.
Page 6 10/89
Slider(3W) UNIX System V Slider(3W)
XtNinitialDelay
Range of Values:
0 < XtNinitialDelay
This resource gives the time, in milliseconds, before the first action
occurs when SELECT is pressed on the Bar or Shaded Bar. Note that
millisecond timing precision may not be possible for all implementations,
so the value may be rounded up to the nearest available unit by the
toolkit.
XtNminLabel
This is the label to be placed next to the minimum value position. For a
vertical slider, the label is placed to the right of the minimum value
position. If there is not enough space for the entire label and
XtNrecomputeSize is FALSE, the label will be truncated from the end. If
there is not enough space for the entire label and XtNrecomputeSize is
TRUE, then the widget will request for more space to show the entire
label.
For an horizontal slider, the label is placed centered and below the
minimum value position. If there is not enough room to center the label
and XtNrecomputeSize is set to FALSE, the beginning of the label will be
aligned with the left anchor and is drawn to the right. If this label
collides with the max label, some part of the labels will overlap. If
there is not enough room to center the label and XtNrecomputeSize is set
to TRUE, the widget will request for more space to center the label below
the minimum value position.
XtNmaxLabel
This is the label to be placed next to the maximum value position. For a
vertical slider, the label is placed to the right of the minimum value
position. If there is not enough space for the entire label and
XtNrecomputeSize is FALSE, the label will be truncated from the end. If
there is not enough space for the entire label and XtNrecomputeSize is
TRUE, then the widget will request for more space to show the entire
label.
For an horizontal slider, the label is placed centered and below the
maximum value position. If there is not enough room to center the label
and XtNrecomputeSize is set to FALSE, the end of the label will be
aligned with the left anchor. If this label collides with the min label,
some part of the labels will overlap. If there is not enough room to
center the label and XtNrecomputeSize is set to TRUE, the widget will
request for more space to center the label below the maximum value
position.
XtNorientation
Range of Values:
OLHORIZONTAL/"horizontal"
OLVERTICAL/"vertical"
10/89 Page 7
Slider(3W) UNIX System V Slider(3W)
This resource defines the direction for the visual presentation of the
widget.
XtNrepeatRate
Range of Values:
0 < XtNrepeatRate
This resource gives the time, in milliseconds, between repeated actions
when SELECT is pressed on the Bar or Shaded Bar. Note that millisecond
timing precision may not be possible for all implementations, so the
value may be rounded up to the nearest available unit by the toolkit.
XtNsliderMax
XtNsliderMin
Range of Values:
XtNsliderMin < XtNsliderMax
These two resources give the range of values tracked by the Slider
widget. Mathematically, the range is open on the right; that is, the
range is the following subset of the set of integers:
XtNsliderMin < range < XtNsliderMax
This is independent of the Drag Box displayed in the Slider widget. The
Slider widget is responsible for taking into account the size of the Drag
Box when relating the physical range of movement to the range of values.
Figure 4. Drag Box Range of Movement
XtNsliderMoved
This resource defines the callback list used when the Slider widget is
manipulated. The calldata parameter is a pointer to the Current Value;
an XtGetValue() inside the callback will return the previous value.
XtNsliderValue
Range of Values:
XtNsliderMin < XtNsliderValue < XtNsliderMax
This resource gives the current position of the Drag Box, in the range [
XtNsliderMin , XtNsliderMax ]. The Slider widget keeps this resource up
to date.
XtNticks
This is the interval between tick marks. The unit of the interval value
is determined by XtNtickUnit.
XtNtickUnit
Range of values:
OL_NONE/"none"
OL_SLIDERVALUE/"slidervalue"
Page 8 10/89
Slider(3W) UNIX System V Slider(3W)
OL_PERCENT/"percent"
This resource can have one of the values: OL_NONE, OL_SLIDERVALUE, and
OL_PERCENT. If it is OL_NONE, then no tick marks will be displayed and
XtNticks is ignored. If it is OL_PERCENT, then XtNticks is interpreted as
the percent of the slider value range. If it is OL_SLIDERVALUE, the
XtNticks is interpreted as the same unit as slider value.
XtNdragCBType
Range of values:
OL_CONTINUOUS/"continuous"
OL_GRANULARITY/"granularity"
OL_RELEASE/"release"
This resource determines the frequency of issuing XtNsliderMoved
callbacks during a drag operation. If set to OL_CONTINUOUS, callbacks
will be issued continuously (just like in Xt+ 2.0). If set to
OL_GRANULARITY, callbacks will only be issued when the drag box crosses
any granularity positions. If set to OL_RELEASE, callback will only be
issued once when the SELECT button is released.
XtNstopPosition
Range of values:
OL_ALL/"all"
OL_TICKMARK/"tickmark"
OL_GRANULARITY/"granularity"
This resource determines the behavior of the drag box at the end of an
drag operation. If set to OL_ALL, upon the release of the SELECT button
in a drag operation, the drag box will be positioned at where it stops.
If set to OL_TICKMARK, the drag box will snap to the nearest tickmark
position. If set to OL_GRANULARITY, the drag box will snap to the nearest
granularity position.
XtNrecomputeSize
This resource, if set to TRUE, allows the slider widget to resize itself
whenever needed, to compensate for the space needed to show the tick
marks and the labels. The slider widget uses the XtNspan, the sizes of
the labels, and XtNtickUnit to determine the preferred size.
XtNfont
This resource specifies the font used to draw the labels. It defaults to
the OPENLOOK standard font.
XtNFontcolor
This resource specifies the color used to draw the labels. It defaults to
the foreground color of the slider widget.
XtNspan
If XtNrecomputeSize is set to TRUE, then XtNspan should be set to reflect
10/89 Page 9
Slider(3W) UNIX System V Slider(3W)
the preferred length of the slider, not counting the space needed for the
labels. The slider widget uses the span value, the sizes of the labels,
and XtNtickUnit to determine the preferred size.
Page 10 10/89