|
From: Joe E. <jen...@fl...> - 2005-08-11 18:09:22
|
Jeff Hobbs wrote:
> Is there any way to control the entry fieldbackground? The
> use case (a pretty standard one) is to signify invalid data
> in the entry field. I've played a bit with style mapping
> for a TEntry variant, but no luck ... is this possible yet?
Depending on the theme:
style map TEntry -fieldbackground {invalid #FF7777}
This doesn't work everywhere -- in particular, it will have
no effect on Windows XP (since the EP_EDITTEXT theme part
always uses system colors, and there's no ETS_* flag
corresponding to an "invalid" state). "-foreground"
ought to work in all themes AFAIK.
Hm... and just to cover all the bases, better do:
style map TEntry \
-fieldbackground {invalid #FF7777} \
-background {invalid #FF7777} \
;
since the various themes aren't completely consistent wrt.
option names in 0.6.
Also, for now you'll need to set [$e state invalid] / [$e state !invalid]
by hand in the -validatecommand.
(The ttk::entry widget should set the 'invalid' bit
automatically whenever revalidation fails, I just haven't
gotten around to implementing it yet. The other part of the
plan is for ttk::entry widgets to accept all edits whenever the
'invalid' bit is set, even when prevalidation fails, and to
automatically clear the bit when (re|pre)validation succeeds.
This will prevent "validation lockout" where you've got an
invalid value and can't make it valid with a single keystroke.)
--Joe English
jen...@fl...
|