[plt-scheme] Multi-line message% ?

From: Erich Rast (Erich.Rast at t-online.de)
Date: Wed Sep 4 05:09:26 EDT 2002

Hello all,

I'm trying to design a standard alert box, but I don't get the message 
text to wrap properly. Even though I set stretchable-width to #f nearly 
everywhere, the dialog always expands its width instead of wrapping the 
message% text. Is there a way to have multi-line messages without using 
text%? (text% fields have a different background on OS X which doesn't 
look good in an alert box.)

Thanks for any help,


P.S. sample code without buttons and icons yet:

(define standard-alert%
   (class dialog%
     (init label)
     (init message)
     (define main-pane ())
     (define v-pane1 ())
     (define heading ())
     (define msg ())
       (super-instantiate ()
         (label "")
         (width 400)
         (height 200)
         (stretchable-width #f))
       (set! main-pane (instantiate horizontal-pane% ()
                         (parent this)
                         (alignment '(left top))
                         (stretchable-width #f)))
       (set! v-pane1 (instantiate vertical-pane% ()
                       (parent main-pane)
                       (alignment '(left top))
                       (stretchable-width #f)
                       (stretchable-height #t)))
       (set! heading (instantiate message% ()
                       (parent v-pane1)
                       (label label)
                       (stretchable-width #f)))
       (set! msg (instantiate message% ()
                   (parent v-pane1)
                   (label message)
                   (vert-margin 24)
                   (stretchable-width #f)
                   (stretchable-height #t)))


(define dlg (make-object standard-alert% "Hello world!" "This is an 
alert dialog for displaying standard system alerts. Please refer to its 
implementation for further details."))
(send dlg show #t)

Posted on the users mailing list.