[racket] racket/gui: changing the background color

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Aug 22 15:36:18 EDT 2014

There's currently no way to set the background color for `message%`
objects, and I'd still use a `canvas%`.

At Tue, 5 Aug 2014 10:47:37 -0500, David Nelson wrote:
> I am working on a manufacturing system to asynchronously program and test
> 16 USB devices. The main display is a grid of "slot" displays. Each slot
> display currently is a group box with the slot number in big digits, a
> status message in normal sized text, and a guage to display the progress.
> I'd like to change the background color of the group box for each slot
> depending on the status. E.g. red for a problem, green for success, yellow
> - in progress, etc..
> The problem is that setting a background color only seems to be possible
> with a canvas%. I seem to have two options:
> 1) Use a canvas for the slot and draw all of the contents.
> 2) Create a subclass of panel% that can position a canvas behind the rest
> of the children.
> In the previous implementation option #1 was used because I needed to work
> around another issue. We used a collection of BeagleBones with small LCD
> displays to drive the slots, one computer per slot. I had to roll my own
> classes to deal with the display physically rotated 90 degrees from normal.
> (The X server did not support rotating the display.) I used a canvas
> filling the top-level frame, and then my rotated-text% and progress-bar%
> classes used absolute positioning and sizing. The draw operation on the
> canvas filled the background, applied a rotation transformation to the dc
> and then for each child it applied the appropriate translation to the
> position of the child and told the child object to draw with the rotated &
> translated device context.
> Comments or suggestions?
> -- David
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.