Discussion:
Disabled checkbox and text color
(too old to reply)
pluton
2004-01-26 11:32:04 UTC
Permalink
Hallo,

When i am setting sel.checked:=false; font color becomes light gray.
This color is too bright.
sel.font.color:= clDark; does not work - checkbox is still light gray.

How can I tune chackbox, to make it 'readonly' and display it in choosen
color ?

TIA
pluton
Rob Kennedy
2004-01-26 16:50:05 UTC
Permalink
Post by pluton
When i am setting sel.checked:=false; font color becomes light gray.
This color is too bright.
sel.font.color:= clDark; does not work - checkbox is still light gray.
It takes its disabled color from your Windows color scheme. When Windows
XP visual styles are enabled for your program, the check box will also
take its enabled color from the system theme.
Post by pluton
How can I tune chackbox, to make it 'readonly' and display it in choosen
color ?
A read-only check box and a disabled check box are not the same things.
Since TCheckBox doesn't have a ReadOnly property, you can fake it by
placing the control on a TPanel and disabling the panel. No controls on
the panel will respond to user input, but they will still paint
themselves as though they were enabled.

If you need a true disabled check box, but want it to use a color that
does not indicate that it is disabled, then I think you'll need to use
an owner-drawn check box. Delphi's TCheckBox doesn't support the
owner-draw style, so you will need to either write a descendant and
include the bs_OwnerDraw style, or find someone else's, maybe at Torry's.
--
Rob
pluton
2004-01-26 17:23:19 UTC
Permalink
Post by Rob Kennedy
placing the control on a TPanel and disabling the panel.
an owner-drawn check box.
Thanks a lot. One more solution from another newgroup :)

CheckBox.enabled:=false;
CheckBox.Caption:='' and put additional label next to my checkbox.

However disabled TPanel i like the most.

Thanks.
pluton

Continue reading on narkive:
Loading...