Board index » delphi » Can't color Button Caption - Why Not?

Can't color Button Caption - Why Not?

Hello,
    I'm working on a class project which involves maintaining and improving
a calculator application, similar to the Windows calculator, in Delphi. I'm
very much a newbie at all this, and I keep having to ask basic questions, so
please bear with me.
    My current problem is that the calculator has a series of buttons whose
captions are the numbers or operations one wishes to work with. Fine. What I
would like to to is group these visually by color, so that the numbers are
captioned in blue, the operations in red, the Clear and Mem buttons in
black, etc.
    This should just be a matter of setting the Font.Color property, right?
Well, I've done that - both in the properties window and via the Fonts
dialogue. The property does indeed appear as clBlue. But this has no visual
effect - the numbers on the buttons are still all black, even though I have
managed to modify the size, font and style to my requirements by the same
means. Is this a bug, or am I just very stupid?
    Many thanks for your help,
Elisa Francesca Roselli
 

Re:Can't color Button Caption - Why Not?


Dans l'article <OTQ9sESK#GA....@ntawwabp.compuserve.com>, "Elisa F Roselli"
<100144.2...@compuserve.com> crit :

Quote
>    This should just be a matter of setting the Font.Color property, right?
>Well, I've done that - both in the properties window and via the Fonts
>dialogue. The property does indeed appear as clBlue. But this has no visual
>effect - the numbers on the buttons are still all black, even though I have
>managed to modify the size, font and style to my requirements by the same
>means. Is this a bug, or am I just very stupid?
>    Many thanks for your help,
>Elisa Francesca Roselli

! Surprising, is'nt it?

I never noticed this, because i never use Buttons. But it's a matter
of fact it does NOT work, no more at run time than at design time. [D3]

So, no color setting and no font.color setting: what are the buttons
supposed to be used for? why not forget it and use TLabel or,
for 3D purpose, TPanel?

P.F.G.

Re:Can't color Button Caption - Why Not?


The TButton color is controlled in the control panel, Display settings.
Use a TBitBtn or TSpeedButton if you want to change the color.

Elisa F Roselli <100144.2...@compuserve.com> skrev i meddelelsen ...

Quote
>would like to to is group these visually by color, so that the numbers are
>captioned in blue, the operations in red, the Clear and Mem buttons in
>black, etc.
>effect - the numbers on the buttons are still all black, even though I have
>managed to modify the size, font and style to my requirements by the same
>means. Is this a bug, or am I just very stupid?

Re:Can't color Button Caption - Why Not?


: "Elisa F Roselli" <100144.2...@compuserve.com> wrote:

Quote
>the numbers on the buttons are still all black, even though I have
>managed to modify the size, font and style to my requirements by the same
>means. Is this a bug, or am I just very stupid?

This is a limitation of the underlying Windows control. IOW, it is
impossible to do this with TButton.

Search the usual Delphi archives for buttons that provide that
functionality.

--
Stefan Hoffmeister    (http://www.econos.de/)
No private email, please, unless expressly invited.

Re:Can't color Button Caption - Why Not?


Thanks to all. The general consensus seems to be to use a BitButton instead
of a standard button, and that the Font.Color property doesn't work because
it depends on Windows settings that have nothing to do with Delphi
programmes. I wonder why Font.Color is there at all? I'll try some
BitButtons and see what happens.

Re:Can't color Button Caption - Why Not?


i created a small popup number pad (like one in MS Money) that
required coloured buttons. What i did was to use the DrawButtonFace()
function to draw buttons on a small form then just print the required
char in the right colour/position.

If you'd like the source code to point you in the right direction my
email address is just below.

--
Peter Collis, Inverell Australia
email: cpby...@abeguarg.pbz.nh
 * ROT13 for email address *

Free Internet Use Timer for 95/NT
www.northnet.com.au/~pcollis/peteWARE.html

Quote
> "Elisa F Roselli" <100144.2...@compuserve.com> wrote:
>Hello,
>    I'm working on a class project which involves maintaining and improving
>a calculator application, similar to the Windows calculator, in Delphi. I'm
>very much a newbie at all this, and I keep having to ask basic questions, so
>please bear with me.
>    My current problem is that the calculator has a series of buttons whose
>captions are the numbers or operations one wishes to work with. Fine. What I
>would like to to is group these visually by color, so that the numbers are
>captioned in blue, the operations in red, the Clear and Mem buttons in
>black, etc.
>    This should just be a matter of setting the Font.Color property, right?
>Well, I've done that - both in the properties window and via the Fonts
>dialogue. The property does indeed appear as clBlue. But this has no visual
>effect - the numbers on the buttons are still all black, even though I have
>managed to modify the size, font and style to my requirements by the same
>means. Is this a bug, or am I just very stupid?
>    Many thanks for your help,
>Elisa Francesca Roselli

Other Threads