[racket] Are slider% callbacks called too often or too late?
Hi All,
I have a little problem with the attached program.
Maybe, I am not 100% sure, the slider% calls the call-back
more than once (maybe 4 times?) after the release of the mouse.
The behaviour puzzles me.
Is it the intended behaviour? If so, is there a better way
to use the slider, than the one in the attached program?
I found the following program by António Leitão from June 2011
on the mailing list, which shows this oddity.
(require racket/gui)
(define frame (new frame% [label "Example"]))
(new slider% [parent frame]
[label "Test"]
[min-value 0]
[max-value 10]
[callback (lambda (slider event)
(display
(format "~a@~a: ~a~%"
(send event get-event-type)
(send event get-time-stamp)
(send slider get-value))))])
(send frame show #t)
On my computer, if I run the program, and then move the
slider to 5 and release the mouse, I get this output:
slider at -273484745: 0
slider at -273484095: 1
slider at -273482097: 5
slider at -273482096: 5
slider at -273482096: 5
slider at -273482096: 5
slider at -273482096: 5
--
Jens Axel Søgaard
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graphical-michaelis-menten.rkt
Type: application/octet-stream
Size: 8459 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20120401/954fc647/attachment.obj>