-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi list,
is it possible to change the background color of say a fr-text-field% dynamically, for example to represent wether the entry is valid (according to some local criterium). I think I would need something that maps from events to actions, like a `foreach-e' or something, instead of `map-e' (which comes closest of the things I find in the docs, but doesn't seem to work): #lang frtime (require frtime/gui/fred racket/draw) (define good-color (send the-color-database find-color "green")) (define bad-color (send the-color-database find-color "red")) (define (field->number f) (let* ((str (send f get-value-b)) (num (string->number str))) (if num num 0))) (define (field->color f) (let* ((str (send f get-value-b)) (num (string->number str))) (if num good-color bad-color))) (define root (new ft-frame% (label "Summator"))) (define field1 (new ft-text-field% (parent root))) (define number1 (field->number field1)) ;(send field1 set-field-background bad-color) (map-e (lambda (c) (send field1 set-field-background c)) (changes (field->color field1))) (define field2 (new ft-text-field% (parent root))) (define number2 (field->number field2)) (define field-sum (new ft-message% (parent root) (stretchable-width #t) (label (string-append "Sum: " (number->string (+ number1 number2)))))) (send root show #t) Marijn -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk4CGDUACgkQp/VmCx0OL2xKPQCfeHA0yP23VV3776B+sXmBd5jf B3EAnieHTkCrdmRDscTc24FOAmV19Z+y =Yw2n -----END PGP SIGNATURE----- _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users