Next: Scrollbar Attributes, Previous: Scrollbar Interaction, Up: Scrollbar Object [Contents][Index]

#### 17.2.4 Other Scrollbar Routines

To change the value and bounds of a scrollbar use the following routines:

    void fl_set_scrollbar_value(FL_OBJECT *obj, double val);
    void fl_set_scrollbar_bounds(FL_OBJECT *obj, double min, double max);

By default, the minimum value for a slider is 0.0, the maximum is 1.0 and the value is 0.5. For vertical sliders the slider position for the minimum value is at the left, for horizontal sliders at the top of the slider. By setting `min` to a larger value than `max` in a call of `fl_set_scrollbar_bounds()` this can be reversed.

If in a call of `fl_set_scrollbar_bounds()` the actual value of a scrollbar isn’t within the range of the new bounds, its value gets adjusted to the nearest limit. When the requested new scrollbar value in a call of `fl_set_scrollbar_value()` is outside the range of bounds it gets adjusted to the nearest boundary value.

To obtain the current value and bounds of a scrollbar use

    double fl_get_scrollbar_value(FL_OBJECT *obj);
    void fl_get_scrollbar_bounds(FL_OBJECT *obj, double *min, double *max);

By default, if the mouse is pressed beside the the sliding bar, the bar starts to jumps in the direction of the mouse position. You can use the following routine to change this size of the steps being made :

    void fl_set_scrollbar_increment(FL_OBJECT *obj, double lj, double rj);

where `lj` indicates how much to increment if the left mouse button is pressed and `rj` indicates how much to jump if the middle mouse button pressed. For example, for the scrollbar in the browser class, the left mouse jump is made to be one page and middle mouse jump is made to be one line. The increment (decrement) value when the scrollbuttons are pressed is set to the value of the right jump. The default values for `lj` and `rj` are `0.1` and `0.02`.

To obtain the current increment settings, use the following routine

    void fl_get_scrollbar_increment(FL_OBJECT *obj, double *lj, double *sj);

With the function

    int fl_get_scrollbar_repeat(FL_OBJECT *obj);
    void fl_set_scrollbar_repeat(FL_OBJECT *obj, int millisec);

you can determine and control the time delay (in milliseconds) between jumps of the knob when the mouse button is kept pressed down outside of the knobs area. The default value is 100 ms. The delay for the very first jump is twice that long in order to avoid jumping to start too soon when only a single click was intended but the user is a bit slow in releasing the mouse button.

Next: Scrollbar Attributes, Previous: Scrollbar Interaction, Up: Scrollbar Object [Contents][Index]