Discussion:
TButton.Color
Vincent Snijders
2007-07-18 17:35:29 UTC
Permalink
I am looking at bug 1188: TButton.Color doesn't work on windows.
http://www.freepascal.org/mantis/view.php?id=1188

Does anybody know how to change the buttons color on windows (without
resorting to ownerdrawn)?

Vincent
Felipe Monteiro de Carvalho
2007-07-18 17:40:10 UTC
Permalink
Post by Vincent Snijders
Does anybody know how to change the buttons color on windows (without
resorting to ownerdrawn)?
I find it strange that it doesn't work on Windows. According to this screenshot:

http://wiki.lazarus.freepascal.org/Windows_CE_Interface#Screenshots

It works on WinCE

So it's obviously possible. (sorry, I don't know how).
--
Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho
2007-07-18 17:41:19 UTC
Permalink
On 7/18/07, Felipe Monteiro de Carvalho
Post by Felipe Monteiro de Carvalho
It works on WinCE
Or maybe that is just a rectangle? the WinCE button is so simple that
I always thougth that was a button, but looking again now I see it
could be a rectangle with text inside =)
--
Felipe Monteiro de Carvalho
Alexander Klenin
2007-07-19 09:34:05 UTC
Permalink
Post by Vincent Snijders
I am looking at bug 1188: TButton.Color doesn't work on windows.
http://www.freepascal.org/mantis/view.php?id=1188
Does anybody know how to change the buttons color on windows (without
resorting to ownerdrawn)?
There is no way to change a color of standard Windows button, except
for system-wide change via Control Panel. Correspondingly, there is no
TButton.Color property in Delphi.
(See also http://msdn2.microsoft.com/en-us/library/ms673328.aspx#button_color_messages).
The color actually used is available in Delphi as clBtnFace constant.

Personally, I would say that this is ok, as it improves interface consistency.
Instead of adding TButton.Color property, a descendant component (e.g.
TColorButton or TCustomButton) should be implemented on all
widgetsets.
--
Alexander S. Klenin
Insight Experts Ltd.
Graeme Geldenhuys
2007-07-19 10:06:46 UTC
Permalink
Post by Alexander Klenin
There is no way to change a color of standard Windows button, except
for system-wide change via Control Panel. Correspondingly, there is no
TButton.Color property in Delphi.
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.

It's a limitation of Lazarus, not VCL or CLX.

Regards,
- Graeme -
Henry Vermaak
2007-07-19 10:14:08 UTC
Permalink
Post by Graeme Geldenhuys
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.
that's weird, i can't find button.color in delphi 7. which delphi are
you talking about?

henry
Graeme Geldenhuys
2007-07-19 10:46:12 UTC
Permalink
Post by Henry Vermaak
that's weird, i can't find button.color in delphi 7. which delphi are
you talking about?
I used Delphi 5 for those projects, but unfortunately don't have it
installed here to check. Maybe I used transparency or flat buttons,
it's been a while. :) I do have Kylix 3 installed though and it has
Color defined in TControl.

Regards,
- Graeme -
Alexander Klenin
2007-07-19 10:53:13 UTC
Permalink
Post by Graeme Geldenhuys
Post by Alexander Klenin
There is no way to change a color of standard Windows button, except
for system-wide change via Control Panel. Correspondingly, there is no
TButton.Color property in Delphi.
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.
It's a limitation of Lazarus, not VCL or CLX.
I am not sure what version of Delphi you are talking about, but at
least under Delphi 7,
Color is protected property of TControl which is not published by its
descendants
TColor -> TWinControl -> TButtonControl -> TButton.
Forcing access to it via inheritance and setting Color property anyway
has no effect -- I just checked.
--
Alexander S. Klenin
Insight Experts Ltd.
Michael Van Canneyt
2007-07-19 12:35:26 UTC
Permalink
Post by Alexander Klenin
Post by Graeme Geldenhuys
Post by Alexander Klenin
There is no way to change a color of standard Windows button, except
for system-wide change via Control Panel. Correspondingly, there is no
TButton.Color property in Delphi.
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.
It's a limitation of Lazarus, not VCL or CLX.
I am not sure what version of Delphi you are talking about, but at
least under Delphi 7,
Color is protected property of TControl which is not published by its
descendants
TColor -> TWinControl -> TButtonControl -> TButton.
Forcing access to it via inheritance and setting Color property anyway
has no effect -- I just checked.
I can confirm this with D7.

The CLX TButton does have it, but that is because it uses Qt, which does allow
you to set the color of a button.

Michael.
Graeme Geldenhuys
2007-07-19 12:01:18 UTC
Permalink
Post by Michael Van Canneyt
I can confirm this with D7.
Thanks.
Post by Michael Van Canneyt
The CLX TButton does have it, but that is because it uses Qt, which does allow
you to set the color of a button.
And I can confirm it works under fpGUI as well. ;-)

Regards,
- Graeme -

Bisma Jayadi
2007-07-19 11:29:52 UTC
Permalink
Post by Graeme Geldenhuys
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.
http://delphi.about.com/od/vclwriteenhance/l/aa061104a.htm

-Bee-

has Bee.ography at:
http://beeography.wordpress.com
Vincent Snijders
2007-07-19 11:32:54 UTC
Permalink
Post by Bisma Jayadi
Post by Graeme Geldenhuys
I'm afraid you are wrong here! TButton under Delphi and Kylix has a
Color property, which was introduced by TControl. And yes under
Delphi it does change the button's face color. We have used this in
some of our multimedia applications.
http://delphi.about.com/od/vclwriteenhance/l/aa061104a.htm
I see. Ownerdrawn.

Vincent
Continue reading on narkive:
Loading...