SLIDER phrase

Describes a slider representation of a field or variable. A slider is a graphical representation of a numeric range. It is composed of a rectangular area that contains a line or trackbar. A marker or pointer within the region indicates the current value. The SLIDER phrase is an option of the VIEW-AS phrase.

Note: Does not apply to SpeedScript programming.

Syntax

VIEW-AS SLIDER
  MAX-VALUE max-value MIN-VALUE min-value
 [ HORIZONTAL | VERTICAL ]
 [ NO-CURRENT-VALUE ]
 [ LARGE-TO-SMALL ]
 [ TIC-MARKS { NONE | TOP | BOTTOM | LEFT | RIGHT | BOTH }
   [ FREQUENCY n ] ]
 [ TOOLTIP tooltip ]
 [ size-phrase ]
MAX-VALUE max-value MIN-VALUE min-value

Sets the range of values for the slider. Both max-value and min-value must be integer constants. Depending on the windowing system in use, the maximum value, minimum value, or both can be displayed with the slider. If you do not specify either a minimum value or a maximum value, the default is 0. Max-value must be greater than min-value.

In Windows only, you can use the MAX-VALUE and MIN-VALUE options with the LARGE-TO-SMALL option to indicate that the slider's maximum display value displays first and the minimum value displays last as you move the slider control.

HORIZONTAL | VERTICAL
Specifies the orientation of the slider. If the orientation is VERTICAL, the slider displays with the minimum value at the bottom and the maximum value at the top. The user can then change the value by moving the trackbar up or down. If the orientation is HORIZONTAL (the default), the slider displays with the minimum value at the left and the maximum value at the right. The user can then change the value by moving the bar left or right.
NO-CURRENT-VALUE

The default is to display the current value for a given position on the slider control. The NO-CURRENT-VALUE option allows you to override this default behavior to indicate that the slider will not automatically display the current value of the slider.

For example, if the MIN-VALUE is 10, the default is to display the value 10 when the slider is first realized, and to update the displayed value whenever a user moves the slider trackbar.

The NO-CURRENT-VALUE option is supported in Windows only.

LARGE-TO-SMALL

The default numeric range that a slider can display is small (minimum) to large (maximum). The LARGE-TO-SMALL option allows you to override this default behavior as follows:

  • When the slider is positioned horizontally, the left-most position on the trackbar displays the maximum value and the right-most position displays the minimum value.
  • When the slider is positioned vertically, the bottom-most position on the trackbar displays the maximum value and the top-most position displays the minimum value.

The LARGE-TO-SMALL option is supported in Windows only.

TIC-MARKS { NONE | TOP | BOTTOM | LEFT | RIGHT | BOTH }

Enables the display of short hash marks on the outside of a slider to help indicate the movement of the trackbar with the slider widget. The default is not to display tic marks. If you specify the TIC-MARKS option, it is assumed that you are using new code to create a slider, and the trackbar on the slider widget will be relatively large.

However, if you leave the TIC-MARKS option out, ABL assumes that you are migrating old code, and the default size of the slider is the size originally defined for the slider in the old code.

If you want to use the large trackbar but do not want tic marks to display, specify TIC-MARKS NONE.

To implement the TIC-MARKS option, you must also specify on which side, or sides, of the trackbar tick-marks display by using the additional TOP, BOTTOM, LEFT, RIGHT, or BOTH qualifying options.

The TIC-MARKS option is supported in Windows only.

FREQUENCY n

Used only with the TIC-MARKS option, indicates the incremental display of the TIC-MARKS. For example, if you indicate a frequency of 5, a tic mark displays in every fifth position along the slider bar.

The FREQUENCY option is supported in Windows only.

TOOLTIP tooltip

Allows you to define a help text message for a text field or text variable. The AVM automatically displays this text when the user pauses the mouse pointer over a text field or text variable for which a ToolTip is defined.

You can add or change the TOOLTIP option at any time. If TOOLTIP is set to "" or the Unknown value (?), then the ToolTip is removed. No ToolTip is the default. The TOOLTIP option is supported in Windows only.

size-phrase
Specifies the outside dimensions of the slider widget. This is the syntax for size-phrase:
{ SIZE | SIZE-CHARS | SIZE-PIXELS } width BY height

For more information, see the SIZE phrase reference entry.

Example

The following procedure displays a slider with tic-marks noted every tenth position, and prompts the user to pick an integer value. After the user picks an integer, the program displays in a separate frame the text "You selected" followed by the value.

r-slide.p

DEFINE VARIABLE choice AS INTEGER NO-UNDO LABEL "You selected".
DEFINE VARIABLE a      AS INTEGER NO-UNDO.

UPDATE a VIEW-AS SLIDER MAX-VALUE 100 MIN-VALUE 1 SIZE-CHAR 33 BY 3 
  TIC-MARKS BOTTOM FREQUENCY 10
  LABEL "Slide to select an integer. Then press GO."
  WITH FRAME f Three-D.

choice = a.

DISPLAY choice WITH FRAME b SIDE-LABELS THREE-D.
PAUSE.

Notes

See also

VIEW-AS phrase