C
SLIDER * SldCreate( WORD ID, SHORT left, SHORT top, SHORT right, SHORT bottom, WORD state, WORD range, WORD page, WORD pos, GOL_SCHEME * pScheme );
Overview
This function creates a SLIDER object with the parameters given. Depending on the SLD_SCROLLBAR state bit slider or scrollbar mode is set. If SLD_SCROLLBAR is set, mode is scrollbar; if not set mode is slider. It automatically attaches the new object into a global linked list of objects and returns the address of the object.
Input Parameters
Input Parameters |
Description |
WORD ID |
Unique user defined ID for the object instance. |
SHORT left |
Left most position of the Object. |
SHORT top |
Top most position of the Object. |
SHORT right |
Right most position of the Object. |
SHORT bottom |
Bottom most position of the Object. |
WORD state |
This defines the initial state of the Object. |
WORD range |
This specifies the maximum value of the slider when the thumb is on the rightmost position for a horizontal orientation and bottom most position for the vertical orientation. Minimum value is always at zero. |
WORD page |
This is the incremental change of the slider when user action requests to move the slider thumb. This value is added or subtracted to the current position of the thumb. |
WORD pos |
This defines the initial position of the thumb. |
GOL_SCHEME * pScheme |
The pointer to the style scheme used for the Object. Set to NULL if default style scheme is used. |
Returns
Returns the pointer to the object created.
Preconditions
none
Side Effects
none
Example
GOL_SCHEME *pScheme; SLIDER *slider[3]; WORD state; pScheme = GOLCreateScheme(); // create a slider with // range = [0 – 50000] // delta = 500 // initial position = 25000 state = SLD_DRAW; slider[0] = SldCreate( 5, 150, 145, 285, 181, state, 50000, 500, 25000, pScheme); if (slider[0] == NULL) return 0; // create a scrollbar with // range = [0 – 100] // delta = 20 // initial position = 0 state = SLD_DRAW|SLD_SCROLLBAR; slider[1] = SldCreate( 6, 150, 190, 285, 220, state, 100, 20, 0, pScheme); if (slider[1] == NULL) return 0; // create a vertical slider with // range = [0 – 30] // delta = 2 // initial position = 20 state = SLD_DRAW|SLD_VERTICAL; slider[2] = SldCreate( 7, 120, 145, 140, 220, state, 30, 2, 20, pScheme); if (slider[2] == NULL) return 0; // draw the sliders while(!sldDraw(slider[0]); // draw the horizontal slider while(!sldDraw(slider[1]); // draw the horizontal scroll bar while(!sldDraw(slider[2]); // draw the vertical slider return 1;