Re: XForms: counter with wrap around?

Trent Piepho (xyzzy@u.washington.edu)
Wed, 5 May 1999 23:01:16 -0700 (PDT)

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

On Wed, 5 May 1999, Steve Lamont wrote:
> # To subscribers of the xforms list from spl@szechuan.ucsd.edu (Steve Lamont) :
> > 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.
> >
> > [...]
> >
> > 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.
>
> Both of these things can be trivially accomplished using the counter
> filter function.

That's a clever hack, changing the counter value from within the filter
function. If you want to skip a single number, it's harder, because you don't
know which direction the counter is going. e.g if you want to skip 13, and
the value is 13, you don't know if the filter should change the value to 12 or
14. A solution could be to reduce the step size to 0.25, then it would be
possible to tell which direction to move.

But it would certainly be less of a kludge if there was a plugin function for
a counter to set the next value, like the filter function.

_________________________________________________
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/