[plt-scheme] Sliders in scheme/gui: platform-dependent orientation

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Oct 16 08:37:48 EDT 2009

I agree that it would be better to flip over the Mac control to make it
consistent with other platforms.

Does anyone rely on the current direction, or should I just flip it?

At Thu, 15 Oct 2009 11:45:39 +1100, Andrew Reilly wrote:
> Hi there,
> 
> I posted something like this little demo as part of a previous
> question, but here it is again, slightly modified:
> 
> #lang scheme/gui
> 
> (let ((t (thread (lambda ()
>                    (let ((start (current-milliseconds)))
>                      (let loop ()
>                        (printf "~a: ~a~%" 
>                                (- (current-milliseconds) start)
>                                (thread-receive))
>                        (flush-output)
>                        (loop))))))
>       (f (new frame% (label "SLIDER TEST"))))
>   (new slider%
>        (parent f)
>        (label "foo")
>        (min-value 0)
>        (max-value 400)
>        (init-value 200)
>        (style '(vertical vertical-label plain))
>        (min-height 50)
>        (min-width 400)
>        (callback
>         (lambda (s e)
>           (thread-send t (send s get-value)))))
>   (send f show #t)
>   (yield 'wait)
>   (kill-thread t))
> 
> The only difference here is that the style is now vertical.
> If you run this from the IDE or from mred on Windows or Unix,
> you'll find that location min-value is at the top, and max-value
> is at the bottom.
> 
> Run it on OS-X though, and min-value is at the bottom.  I
> suppose that this is a side-effect of the Aqua/Postscript
> drawing model that has 0,0 in the bottom left corner of the
> page/screen, compared to everyone else who puts it in the top
> left corner.
> 
> This isn't too difficult to fix in my code, but it seems a
> little unfortunate to have to put (system-type 'os) calls into
> what is otherwise a portable GUI.
> 
> Just thought I'd mention it, as this doesn't seem to be
> described in the manual.
> 
> Cheers,
> 
> -- 
> Andrew
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.