Yes, this is exactly what I want. Thank you a lot.

-- Mianlai

On Fri, Jul 17, 2015 at 4:36 PM, Matthew Flatt <mfl...@cs.utah.edu> wrote:

> At Fri, 17 Jul 2015 15:16:34 +0800, Mianlai Zhou wrote:
> > I have the following code:
> >
> > #lang racket
> >
> > (require slideshow racket/class racket/gui/base)
> >
> > (define my-frame (new frame% [label "My chess"]
> >                                   [width 300] [height 391]
> >                                   [alignment '(center center)] ))
> >
> > (define my-canvas
> >       (new (class canvas%
> >              (super-new [parent my-frame])
> >              [define/override (on-paint)
> >                (define my-dc (send my-canvas get-dc))
> >                (send my-dc clear)
> >                ((make-pict-drawer (colorize (circle 225) "red")) my-dc 20
> > 20)
> >                 ]
> >              [define/override (on-char ch)
> >                (define key (send ch get-key-code))
> >                (if (eq? key 'release) (send my-canvas on-paint) null)
> >              ]
> >              )))
> >
> > (new button% [parent my-frame]  [label "Replay"] )
> > (new button% [parent my-frame] [label "Save"] )
> >  (new button% [parent my-frame] [label "Load"] )
> >
> > (send my-frame show #t)
> >
> >
> > which runs perfectly with no error. However, I want to add two new
> bottons
> > "Play" and "Draw" on the left and right of the button "Replay". I tried
> to
> > use
> > horizontal-pane, changing the last several lines in the code as:
> >
> > (define my-pane (new horizontal-pane% [parent my-frame] [alignment
> '(center
> > center)] ))
> >
> > (new button% [parent my-pane]  [label "Play"] )
> > (new button% [parent my-pane]  [label "Replay"] )
> > (new button% [parent my-pane]  [label "Draw"] )
> >
> > (new button% [parent my-frame] [label "Save"] )
> > (new button% [parent my-frame] [label "Load"] )
> >
> > (send my-frame show #t)
> >
> > However, this is not what I wanted. The area of horizontal pane
> > is obviously too large, and it makes the three buttons too distant
> > from the two buttons below, also it shadows the main area above.
> > Is there a way to minimize the width of the horizontal pane such that
> > the outlook is the same as if not using it (the original code pasted
> above)?
>
> I think you want to make the panel have a non-stretchable height:
>
>  (define my-pane (new horizontal-pane%
>                       [parent my-frame]
>                       [alignment '(center center)]
>                       [stretchable-height #f]))
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to