[racket] Specifying GUI item sizes in percentages not pixels

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Apr 25 21:47:59 EDT 2012

At Thu, 19 Apr 2012 23:14:58 -0400, Harry Spier wrote:
> In the Racket GUI framework is there a way to specify the sizes of
> windows and dialogs not in pixels but in percentage of either the
> screen for a top level window or in percentages of the containing
> window.

No, there's no support like that built into the `racket/gui' classes.
There's a `panel:dragable-mixin' in `framework', but I don't think
that's what you're looking for. 

For top-level windows, I think you'd have to take the size of the
screen and calculate a percentage. If you're interested in the
possibility that the screen size can change, unfortunately there's
currently no callback for that in `racket/gui'.

Percentage-based sizing for elements within a top-level window could be
implemented by deriving a new container class (i.e., a subclass of
`panel%' or `pane%') that overrides `place-children'.


Posted on the users mailing list.