[plt-scheme] Re: scroll-event produce wrong direction?
Sorry , i forgot to attach the output.
Output:
Direction : vertical
Direction : vertical
Direction : vertical
Direction : vertical
Direction : vertical
Direction : vertical
Direction : vertical
Direction : vertical
Direction : horizontal
On Tue, Nov 25, 2008 at 9:35 PM, Veer <diggerrrrr at gmail.com> wrote:
> 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
>