Hi all,<br><br>How do I change the background color (and/or style of border etc.) of a GUI button? Given the code below, what should I put in the set-state-x methods to indicate a difference between a normal and selected button?<br>
<br>Also any comments on program style and/or substance are appreciated (I apologize in advance if the layout offends).<br><br>Cheers,<br><br>Kieron.<br><br>**** <br><br>#lang racket/gui<br><br>(define color-button%<br> (class button%<br>
(inherit refresh)<br><br> (define toggle<br> (let ([f #f]) <br> (lambda () <br> (set! f (not f)) <br> f<br> )<br> )<br> ) <br> <br> (define (set-state-normal)<br>
(printf "color-button%: set-state-normal:\n")<br> ; ??? ; set background color to normal <br> (refresh)<br> )<br><br> (define (set-state-selected)<br> (printf "color-button%: set-state-selected:\n")<br>
; ??? ; set background color to red<br> (refresh)<br> )<br> <br> (define click-callback<br> (lambda (button control-event)<br> (printf "color-button%: click-callback:\n")<br> (if (toggle)<br>
(set-state-selected)<br> (set-state-normal)<br> )<br> )<br> )<br><br> (super-new (callback click-callback))<br><br> )<br> )<br><br>(define f (new frame%<br> [label "Colored Button"]<br>
[min-width 100]<br> [min-height 200]<br> )<br> )<br><br>(define b (new color-button%<br> [parent f]<br> [label "push me"]<br> )<br>
)<br><br>(send f show #t)<br><br>