Next: Spinner Attributes, Previous: Spinner Interaction, Up: Spinner Object [Contents][Index]
Probably the most often used spinner functions are
double fl_get_spinner_value(FL_OBJECT *obj ); double fl_set_spinner_value(FL_OBJECT *obj, double val);
The first one returns the value of a spinner. The type of the return
value is a double for both integer and floating point spinners, so
you have to convert it for integer spinners appropriately, e.g:
using the FL_nint() macro, that converts a double to the
nearest integer value.
You can set or retrieve the upper and lower limit the value a spinner can be set to using the functions
void fl_set_spinner_bounds(FL_OBJECT *obj, double min, double max); void fl_get_spinner_bounds(FL_OBJECT *obj, double *min, double *max);
Since this function is to be used for integer as well as floating
point spinner objects the double type values must be converted
as necessary for FL_INT_SPINNER.
The default limits are -10000 and 10000, but can be
set to up to INT_MIN and INT_MIN for
FL_INT_SPINNERs and -DBL_MAX and DBL_MAX
for FL_FLOAT_SPINNERs.
To set or determine the step size by which a spinner will be incremented or decremented when one of the buttons is clicked on use
void fl_set_spinner_step(FL_OBJECT *obj, double step); double fl_get_spinner_step(FL_OBJECT *obj);
The default step size is 1 for both FL_INT_SPINNER
and FL_FLOAT_SPINNER objects.
For FL_FLOAT_SPINNER objects you can set (or determine)
how many digits after the decimal point are shown by using
void fl_set_spinner_precision(FL_OBJECT *obj, int prec); int fl_get_spinner_precision(FL_OBJECT *obj);
This is per default set to 6 digits after the decimal point. The
function for setting the precision has no effect on
FL_INT_SPINNER objects and the other one returns 0 for
this type of spinners.
Next: Spinner Attributes, Previous: Spinner Interaction, Up: Spinner Object [Contents][Index]