[racket] racket/gui: changing the background color

From: David Nelson (davidcnelson at gmail.com)
Date: Tue Aug 5 11:47:37 EDT 2014

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140805/f05f713e/attachment.html>

Posted on the users mailing list.