[plt-scheme] newbie GUI question

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Oct 9 23:30:14 EDT 2005

There's not a good way to make a message% change size to match a new
string. There are a few options you have, tho:

  1) create two message% objects and use p1's change-children method
     to show the one you want.

  2) as in #1, except use a panel:single% to hold both message% instances

  3) make the message% stretchable and put it in a place that will be
     wide enough for both messages, perhaps by making the frame have
     some defaultly large-enough width.

  4) make a custom subclass of canvas% that uses the GUI interface in a
     fancier way to make sure it is always wide enough for the string
     it is displaying (this way requires the most sophistication with
     the GUI libraries, but is probably the effect you were looking
     for)

hth,
Robby

At Sun, 9 Oct 2005 22:36:24 -0400, David Richards wrote:
> Given this simple layout:
> 
> 
> (define f1
>    (new frame%
>         (label "test frame")
>         (parent #f)
>         (width 500) (height 500)
>         (x 100) (y 100)
>         (style '(hide-menu-bar no-resize-border))))
> 
> (define p1 (instantiate horizontal-panel% (f1)))
> 
> (define m1 (instantiate message% ("No Event" p1)))
> 
> 
> (define b1 (instantiate button% ("Left" p1 (lambda (button event)
>                                               (send m1 set-label  
> "Left Button Click")))))
> 
> (send f1 show #t)
> 
> 
> How do we resize m1 so that all of the new label text is visible?
> 
> Thanks, -dr
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.