[racket] Bug or feature?

From: Antonio Menezes Leitao (antonio.menezes.leitao at ist.utl.pt)
Date: Fri Jun 3 12:19:42 EDT 2011

Hi,

I noticed a strange behavior in Racket slider% widget.
It seems that when I stop dragging the slider it makes two additional
unnecessary callback calls.  This behavior is visible in the following
example:

(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)

Even a single click in the slider calls the callback twice
when the mouse button is released.

I also noticed that this behavior happens both with Racket in
Windows 7 and with the older DrScheme in Windows XP.

Is this a bug or a feature?

Thanks,
António Leitão



Posted on the users mailing list.