Hi all, 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?
Also any comments on program style and/or substance are appreciated (I apologize in advance if the layout offends). Cheers, Kieron. **** #lang racket/gui (define color-button% (class button% (inherit refresh) (define toggle (let ([f #f]) (lambda () (set! f (not f)) f ) ) ) (define (set-state-normal) (printf "color-button%: set-state-normal:\n") ; ??? ; set background color to normal (refresh) ) (define (set-state-selected) (printf "color-button%: set-state-selected:\n") ; ??? ; set background color to red (refresh) ) (define click-callback (lambda (button control-event) (printf "color-button%: click-callback:\n") (if (toggle) (set-state-selected) (set-state-normal) ) ) ) (super-new (callback click-callback)) ) ) (define f (new frame% [label "Colored Button"] [min-width 100] [min-height 200] ) ) (define b (new color-button% [parent f] [label "push me"] ) ) (send f show #t)
____________________ Racket Users list: http://lists.racket-lang.org/users