Counters

rander+@postbox.ius.cs.cmu.edu
Wed, 19 Mar 97 10:41:50 EST

To subscribers of the xforms list from rander+@postbox.ius.cs.cmu.edu :

I just realized that I can set a counter to a value outside its
valid range. For example,

fl_set_counter_bounds (mycounter, 0.0, 10.0);
fl_set_counter_value (mycounter, -1.0);

will set the counter to have a value of -1, even though the valid
range is [0,10]. If I call

double newval = fl_get_counter_value (mycounter);

then newval will be set to -1 too.

Is this behavior desirable for some reason? I find it really
annoying because I must now keep the counter bounds around. To
make matters worse, I do not see any of the following procedures,
which would at least make it possible to get the values only when
you need them:

/* NON-EXISTENT */ fl_get_counter_bounds ();
/* NON-EXISTENT */ fl_get_counter_upperbound ();
/* NON-EXISTENT */ fl_get_counter_lowerbound ();

If there are no good counter-arguments (pun intended :-) then I
suggest that something change here. At a minimum, there should
be a way to get a counter's current bounds (and, I guess, it's
step -- what about precision?). Perhaps a controllable mode can
be added to force any setting of the counter value to conform
to these constraints, e.g.:

fl_set_counter_mode (FL_OBJECT *obj, int constrained)

or a change to fl_set_counter_value:

fl_set_counter_value (FL_OBJECT *obj, double val, int constrained)

which would only constrain the value if requested -- in which case it
would round to the nearest step and clamp to the valid range.

-Pete (rander@cs.cmu.edu)
_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuf2.usuhs.mil or see
http://bob.usuf2.usuhs.mil/mailserv/xforms.html
Xforms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuf2.usuhs.mil/mailserv/list-archives/xforms-archive/