XForms: counter with wrap around?

Trent Piepho (xyzzy@u.washington.edu)
Wed, 5 May 1999 00:35:45 -0700 (PDT)

# To subscribers of the xforms list from Trent Piepho <xyzzy@u.washington.edu> :

How about adding a wrap around (modulus) to the counter object? For example
if the counter is set to go from 1 to 10 with a step of 1, clicking the
increase button with the counter at 10 would cause it to go back to 1.

One can sort of get this effect using a callback kludge, but there are
limitations. This is done by increasing the counter range by one step, in the
previous example the range would be 0 to 11 for example, and having the
callback set the counter to 1 when it reaches 11, and setting it to 10 when it
reaches 0.

In order to do this, the counter has to be set to activate the callback when
changed (ie FL_RETURN_CHANGED instead of FL_RETURN_END_CHANGED), not on only
on end. With the counter set to FL_RETURN_CHANGED there is no easy way to
detect the end of the change. So if FL_RETURN_END_CHANGED was the behavior
you really wanted, it is hard to achieve.

Then there is a visual glitch, where the counter goes to 11 then changes back
to 1 that gives the application an unpolished look.

Any chance of the this getting added to a new release of xforms? It's not a
hard thing to do. If I had the xforms source I could probably have done it by
now in the time it took me to write this message.

A counter than can count an arbitrary sequence would be nifty too. Count up
by primes, or skip 13, or in my case, skip TV channels that are programmed
out, like a TV or VCR does.

_________________________________________________
To unsubscribe, send the message "unsubscribe" to
xforms-request@bob.usuhs.mil or see
http://bob.usuhs.mil/mailserv/xforms.html
XForms Home Page: http://bragg.phys.uwm.edu/xforms
List Archive: http://bob.usuhs.mil/mailserv/list-archives/