Board index » cppbuilder » Unable to change colour of TCheckBox label in existing project

Unable to change colour of TCheckBox label in existing project


2007-05-14 10:09:49 PM
cppbuilder34
Hi,
I've encountered a strange problem with changing the colour of a
TCheckBox Label (the actual text colour, not the background). Normally,
this isn't a problem. You can simply use the Font->Color property to
change the colour (either via the object inspector at design time or
change it at run-time).
When I add a checkbox to my current project and change the colour of the
checkbox label it does get shown in the correct colour while in design
mode. However, as soon as I run my app the text colour is the default
black again. Even setting the colour propery during run-time does not
resolve the issue (MyCheckBox->Font->Color=clGreen).
Strangely enough, when I start fresh with a new project and add a
TCheckBox I have no problems whatsoever with changing the text colour.
It's just with my current project that I'm having these strange
problems. I even commented out my constructor to completely exclude the
possibility that some of my startup-code was causing this strange
behaviour. But nothing helps...
If anyone has any ideas as to what is causing this strange problem, then
please let me know.
I'm using BDS2006 Update2.
Thanks,
Kris
 
 

Re:Unable to change colour of TCheckBox label in existing project

Could this be because you have XP Theming turned on?
This could over-write your settings. It certainly does for
some other controls.
You won't see this in the BDS2006 designer as it is not
themed.
(Delphi 2007 is themed (and presumably so will C++Builder
2007) and shows this.)
HTH Pete
"Kris" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,

I've encountered a strange problem with changing the
colour of a TCheckBox Label (the actual text colour, not
the background). Normally, this isn't a problem. You can
simply use the Font->Color property to change the colour
(either via the object inspector at design time or change
it at run-time).

When I add a checkbox to my current project and change the
colour of the checkbox label it does get shown in the
correct colour while in design mode. However, as soon as I
run my app the text colour is the default black again.
Even setting the colour propery during run-time does not
resolve the issue (MyCheckBox->Font->Color=clGreen).

Strangely enough, when I start fresh with a new project
and add a TCheckBox I have no problems whatsoever with
changing the text colour. It's just with my current
project that I'm having these strange problems. I even
commented out my constructor to completely exclude the
possibility that some of my startup-code was causing this
strange behaviour. But nothing helps...

If anyone has any ideas as to what is causing this strange
problem, then please let me know.

I'm using BDS2006 Update2.

Thanks,

Kris
 

Re:Unable to change colour of TCheckBox label in existing project

Pete Fraser wrote:
Quote
Could this be because you have XP Theming turned on?
This could over-write your settings. It certainly does for
some other controls.
You're absolutely correct. My current project does use XP theming which
is causing the 'problem'. At least now I know what is causing this.
I assume it won't be possible to change the colour (other than disabling
theming, which isn't an option).
Thanks,
Kris
 

{smallsort}

Re:Unable to change colour of TCheckBox label in existing project

I believe there is a call to turn theming off for a control
but you need to be careful as if you make a checkbox font
red and then a user sets their theme so that red text is
unreadable - your application will be not nice to use.
you probably need to change your UI so that you don't need
to change font colors but use something else.
HTH Pete
"Kris" < XXXX@XXXXX.COM >wrote in message
Quote
Pete Fraser wrote:
>Could this be because you have XP Theming turned on?
>This could over-write your settings. It certainly does
>for some other controls.

You're absolutely correct. My current project does use XP
theming which is causing the 'problem'. At least now I
know what is causing this.

I assume it won't be possible to change the colour (other
than disabling theming, which isn't an option).
 

Re:Unable to change colour of TCheckBox label in existing project

Pete Fraser wrote:
Quote
you probably need to change your UI so that you don't need
to change font colors but use something else.
My application is a wizard style. The navigation bar at the bottom of
the wizard respects the Windows theme. However, the rest of the wizard
is a typical white pane with black text on which the wizard's
functionality is displayed. In order to make absolutely sure that the
checkboxes are correctly displayed on the white background I wanted make
sure they were always displayed in black.
Well, I don't expect to encounter much problems from not setting the
CheckBox text colour. I'm expecting more problems if I force theming off
for the CheckBoxes. So, I'll leave it like it is.
Thanks,
Kris