Cannot set StaticText Font color in CPPBuilder 2010 in Windows 7 [Edit]

Hello,
Since I changed my OS from XP into Windows 7 I discoverd that in all cases changing the Font->Color of a StaticText instance does not have any effect. Often I set the color in the form design to something different from black, but always the color turns out to be black. Also adding a line of code to get the same result, does not work. With the Label component there is no problem.

What is going on here? Do I have to use TLabel in stead of TStaticText?

Regards,  Alexander Stols

Edited by: Alexander Stols on Oct 13, 2011 5:10 AM

Added later: I discovered that using the "classic Windows theme" restores the possibility to change the StaticText Font Color. Currently I use the "Windows 7 theme": this one causes trouble.

Added by: Alexander Stols on Oct 13, 2011 8:11 AM
0 Alexander 10/13/2011 3:14:53 PM
 wrote in message news:410716@forums.embarcadero.com...

> What is going on here?

The coloring comes from the currently active theme.

> Do I have to use TLabel in stead of TStaticText?

In most cases, there is no real benefit to using TStaticText over TLabel in 
general.  TStaticText is a windowed control, so it has its own HWND handle 
and associated OS resources associated with it.  TLabel is a graphical 
control that has no HWND of its own.

-- 
Remy Lebeau (TeamB)
0 Remy 10/13/2011 5:08:38 PM
> {quote:title=Remy Lebeau (TeamB) wrote:}{quote}
> 
> The coloring comes from the currently active theme.
> 
> > Do I have to use TLabel in stead of TStaticText?
> 
> In most cases, there is no real benefit to using TStaticText over TLabel in 
> general.  TStaticText is a windowed control, so it has its own HWND handle 
> and associated OS resources associated with it.  TLabel is a graphical 
> control that has no HWND of its own.

I was afraid so! That means a lot of work is to be done: several projects have the same problem. 
Thanks for the information.

Regards, 
Alexander Stols
0 Alexander 10/13/2011 8:41:28 PM
> {quote:title=Clive Makin wrote:}{quote}
> 
> Just thought I'd mention that I've just come here to get an answer to a similar problem, which I can resolve by using TLabel as suggested above. Well, I thought I had, but TLabel is only the answer provided there is only one line of text. It appears to be limited to one line only.
> 
> To clarify, though, the problem (with TStaticText) only seems to arise if the transparent property is set to *true*. If you don't want to see the underlying component, and therefore transparency can set to *false*, there's no problem setting the text colour, at least, I had none..
> 
> Edited by: Clive Makin on Oct 28, 2011 2:21 PM

Hello Clive,

You are quite right: with the property Transparent = false the type colors do show correctly. Maybe I have some applications left where this solution to the problem still is useful. Thanks.
--
Regards,  Alexander Stols
0 Alexander 10/29/2011 3:50:53 PM
> {quote:title=Alexander Stols wrote:}{quote}
> Hello,
> Since I changed my OS from XP into Windows 7 I discoverd that in all cases changing the Font->Color of a StaticText instance does not have any effect. Often I set the color in the form design to something different from black, but always the color turns out to be black. Also adding a line of code to get the same result, does not work. With the Label component there is no problem.
> 
> What is going on here? Do I have to use TLabel in stead of TStaticText?
> 
> Regards,  Alexander Stols
> 
> Edited by: Alexander Stols on Oct 13, 2011 5:10 AM
> 
> Added later: I discovered that using the "classic Windows theme" restores the possibility to change the StaticText Font Color. Currently I use the "Windows 7 theme": this one causes trouble.
> 
> Added by: Alexander Stols on Oct 13, 2011 8:11 AM

Just thought I'd mention that I've just come here to get an answer to a similar problem, which I can resolve by using TLabel as suggested above. Well, I thought I had, but TLabel is only the answer provided there is only one line of text. It appears to be limited to one line only.

[[Added 14th November 2011. I have since discovered that TLabel _does_ allow for multiple lines, provided that WordWrap is set to true]].

To clarify, though, the problem (with TStaticText) only seems to arise if the transparent property is set to *true*. If you don't want to see the underlying component, and therefore transparency can set to *false*, there's no problem setting the text colour, at least, I had none..

Edited by: Clive Makin on Oct 28, 2011 2:21 PM

Edited by: Clive Makin on Nov 14, 2011 7:13 AM
0 Clive 11/14/2011 3:15:39 PM
Reply:

(Thread closed)