[plt-scheme] scheme/gui: bitmaps in containers

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Mar 17 18:29:39 EDT 2009

At Mon, 16 Mar 2009 21:05:14 +0100, Peter Ngo wrote:
> During which I was trying to create a user menu with some buttons on a
> canvas (with bitmap background). Obviously, it didn't work since the
> buttons can't be created in a canvas.
> So I tried to look for containers which would accept any bitmap as a
> background. But I could only find (set-background-color) or similar
> functions.
> Any ideas?

The GUI toolbox doesn't directly drawing on button containers.

It may be possible to implement a subclass of `panel%' that contains a
canvas plus some buttons, and that overrides `place-children' to place
the buttons and the canvas in the same place so that the buttons draw
over the canvas. I doubt that it will work consistently on all
platforms, though.

Another possibility is the `embedded-gui' library, which implements
some controls to go inside an `editor<%>', and you can also override
the `on-paint' method of an `editor<%>' to draw the background. The
`embedded-gui' library doesn't use the platform widgets at all, so you
don't get the same look-and-feel.

Posted on the users mailing list.