[racket] Possible bug with init-auto-scrollbars
That's a bug in v6.1 and earlier (on platforms other than Mac OS X).
The bug has been fixed for the next version, so you could try a
snapshot from
http://pre.racket-lang.org/
If you need to stick with a different version, I think you can work
around the bug by creating a `canvas%` subclass that calls
`init-auto-scrollbars` on each `on-resize`:
#lang racket
(require racket/gui)
(define frame (new frame%
[label "Example"]
[width 300]
[height 300]))
(define workaround-canvas%
(class canvas%
(super-new)
(inherit init-auto-scrollbars)
(define/override (on-size w h)
(init-auto-scrollbars 500 500 0.0 0.0))))
(define canv (new workaround-canvas%
[parent frame]
[style '(vscroll hscroll)]
[paint-callback
(lambda (canvas dc)
(send dc draw-ellipse 0 0 500 500))]))
(send frame show #t)
At Wed, 10 Sep 2014 19:29:53 -0500, Amy Stahlman wrote:
> I've been working on a program that uses "init-auto-scrollbars" and I
> noticed that when the window is resized it actually changes the size of the
> virtual canvas along with the literal canvas instead of just resizing the
> scrollbar and changing the size of the literal canvas.
>
> Here's an example that shows this:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *(require racket/gui)(define frame (new frame% [label
> "Example"] [width 300] [height
> 300]))(define canv (new canvas% [parent frame] [style '(vscroll
> hscroll)] [paint-callback (lambda (canvas dc)(send
> dc draw-ellipse 0 0 500 500))]))(send frame show #t)(send canv
> init-auto-scrollbars 500 500 0.0 0.0)*
>
> Resize the window, making it large enough to show the entire ellipse;
> notice how the scrollbar's relative size doesn't change, and there is blank
> space at the bottom.
> Is this by design or some kind of bug?
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users