![]() |
![]() |
![]() |
![]() |
A widget for choosing a value from a range
PtWidget --> PtBasic --> PtGauge --> PtSlider
For more information, see the diagram of the widget hierarchy.
<photon/PtSlider.h>
A PtSlider widget lets you choose numerical values within a specified range from minimum to maximum.
A PtSlider widget.
A slider consists of a narrow trough (representing the total range), a movable handle, and optional tick marks. The handle -- which appears on top of the trough -- represents the current position within the range. The size of the handle is determined by Pt_ARG_SLIDER_HANDLE_WIDTH or by the size of Pt_ARG_SLIDER_IMAGE.
When you press the mouse button, the result depends on the location of the pointer.
If the pointer is: | Then: |
---|---|
In the trough | The handle moves up or down one slider multiple |
On the handle | A drag is started |
If you hold down the Ctrl key and click in the trough, the handle jumps to the position of the pointer.
If you press: | The handle moves: |
---|---|
/\ | Up one increment |
\/ | Down one increment |
--> | Right one increment |
<-- | Left one increment |
Pg Up | Up/right one "page" |
Pg Down | Down/left one "page" |
Home | To the minimum value |
End | To the maximum value |
where:
Resource | C type | Pt type | Default |
---|---|---|---|
Pt_ARG_SLIDER_FLAGS | short int | Flag | 0 |
Pt_ARG_SLIDER_HANDLE_COLOR | PgColor_t | Scalar | PgGrey(217) |
Pt_ARG_SLIDER_HANDLE_WIDTH | short int | Scalar | 15 |
Pt_ARG_SLIDER_IMAGE | void * | Alloc | NULL |
Pt_ARG_SLIDER_INCREMENT | ushort_t | Scalar | 1 |
Pt_ARG_SLIDER_MULTIPLE | ushort_t | Scalar | 0 |
Pt_ARG_SLIDER_THICKNESS | ushort_t | Scalar | 15 |
Pt_ARG_SLIDER_TICK_MAJOR_DIV | short int | Scalar | 10 |
Pt_ARG_SLIDER_TICK_MAJOR_LEN | short int | Scalar | 10 |
Pt_ARG_SLIDER_TICK_MINOR_DIV | short int | Scalar | 0 |
Pt_ARG_SLIDER_TICK_MINOR_LEN | short int | Scalar | 0 |
Pt_CB_SLIDER_MOVE | PtCallback_t * | Link | NULL |
C type | Pt type | Default |
---|---|---|
short int | Flag | 0 |
Valid flags:
C type | Pt type | Default |
---|---|---|
PgColor_t | Scalar | PgGrey(217) |
The color of the slider handle. See PgColor_t in the Photon Library Reference.
C type | Pt type | Default |
---|---|---|
short int | Scalar | 15 |
The width of the slider handle.
C type | Pt type | Default |
---|---|---|
void * | Alloc | NULL |
The image that's displayed as the handle if Pt_SLIDER_IMAGE is set in Pt_ARG_SLIDER_FLAGS.
C type | Pt type | Default |
---|---|---|
ushort_t | Scalar | 1 |
The slider increment when you press the cursor keys.
C type | Pt type | Default |
---|---|---|
ushort_t | Scalar | 0 |
The slider increment when you click the pointer button in the trough, or you press Pg Up or Pg Down.
C type | Pt type | Default |
---|---|---|
ushort_t | Scalar | 15 |
The thickness of the slider handle, in pixels.
C type | Pt type | Default |
---|---|---|
short int | Scalar | 10 |
The number of major divisions.
C type | Pt type | Default |
---|---|---|
short int | Scalar | 10 |
The length of the major ticks, in pixels.
C type | Pt type | Default |
---|---|---|
short int | Scalar | 0 |
The number of minor divisions per major division.
C type | Pt type | Default |
---|---|---|
short int | Scalar | 0 |
The length of the minor ticks, in pixels.
C type | Pt type | Default |
---|---|---|
PtCallback_t * | Link | NULL |
A list of PtCallback_t structures that define the callbacks that the slider invokes when the handle position changes.
If you've set the Pt_CALLBACKS_ACTIVE bit set in the widget's Pt_ARG_FLAGS resource, these callbacks are also invoked when your application changes the handle position by calling PtSetResource() or PtSetResources().
Each callback is passed a PtCallbackInfo_t structure that contains at least the following members:
These callbacks should return Pt_CONTINUE.
If the widget modifies an inherited resource, the "Default override" column indicates the new value. This modification affects any subclasses of the widget.
![]() |
![]() |
![]() |
![]() |