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

From: Andrew Reilly (areilly at bigpond.net.au)
Date: Wed Oct 14 20:45:39 EDT 2009

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



Posted on the users mailing list.