[plt-scheme] scroll-event produce wrong direction?

From: Veer (diggerrrrr at gmail.com)
Date: Tue Nov 25 11:05:16 EST 2008

Hello ,

The code below captures the on-scroll event and outputs the direction.
So when i run the program and continuously drag the vertical scrollbar
the output produces "vertical" which is correct , but once i stop dragging
the bar the last output is "horizontal" . Since i have enabled only
vertical scrollbar , any reason for this?

Code :

(define a-frame
  (new frame%
       [label "Scrollbars"]
       [width 300]
       [height 300]))

(define scroll-canvas%
  (class canvas%

    (super-new)
    (inherit get-dc)

    (define (char-height)
      (send (get-dc) get-char-height))

    (define (page-unit)
      (inexact->exact
       (floor (/ (send this get-height) (char-height)))))

    (define/override (on-size w h)
      (send this set-scroll-page 'vertical (page-unit)))

    (define/override (on-scroll event)
      (printf "Direction : ~a\n" (send event get-direction)))

    (send this init-manual-scrollbars #f 100 1 (page-unit) 0 0)

    ))

(define scroll (new scroll-canvas% [parent a-frame] [style '(vscroll)]))
(send a-frame show #t)

Thanks
Veer


Posted on the users mailing list.