Look like this will work very nicely indeed ... Thanks.<br><br>Am I correct in thinking that 'button-colors' models a 3-element ring buffer where 'cdr' advances the access window one element?<br><br><div class="gmail_quote">
On Thu, Feb 23, 2012 at 10:59 AM, Matthias Felleisen <span dir="ltr"><<a href="mailto:matthias@ccs.neu.edu">matthias@ccs.neu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
Would this work for you:<br>
<br>
#lang racket/gui<br>
<br>
(define (make-colored-bm color:str)<br>
[define bm (make-object bitmap% 200 200)]<br>
[define dc (make-object bitmap-dc% bm)]<br>
(send dc set-brush (make-object brush% color:str 'solid))<br>
(send dc draw-rectangle 0 0 200 200)<br>
(send dc set-bitmap #f)<br>
bm)<br>
<br>
(define frame (new frame% [label "test"] [width 200] [height 200]))<br>
<br>
(define panel (new panel% [parent frame]))<br>
<br>
(define button-colors<br>
(shared ([c (append (map make-colored-bm '("green" "red" "blue")) c)])<br>
c))<br>
<br>
(define buttn<br>
(new button%<br>
[label (car button-colors)]<br>
[parent panel]<br>
[callback (lambda (b e)<br>
(set! button-colors (cdr button-colors))<br>
(send buttn set-label (car button-colors)))]))<br>
<br>
(send frame show #t)<br>
<br>
</blockquote></div><br>