Recent

Author Topic: Button.Color - stays grey  (Read 1073 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
Button.Color - stays grey
« on: July 01, 2022, 06:38:21 pm »
I have a TButton and want to color it.
At runtime it stays grey. In Delphi this was a setting of "style" or so, which overwrote my user-color - but I cannot find it in Lazarus.
Neither I can find something, the Lazarus IDE hints like "ParentColor".

Please hint: What is is, which prevents my color to flush red?
Thanks.

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Button.Color - stays grey
« Reply #1 on: July 01, 2022, 06:52:48 pm »
Did you meant on Windows?

I do not use Windows but in my Object Inspector, it clearly shows TButton.Color is restricted on Windows. TButton and most of Lazarus default installed visual components depend on the OS, if the OS does not allowed it, you can't have it.

Otherwise there are several good looking visual components, for example:
https://wiki.lazarus.freepascal.org/Eye-Candy_Controls
« Last Edit: July 01, 2022, 06:54:48 pm by Handoko »

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: Button.Color - stays grey
« Reply #2 on: July 01, 2022, 10:03:21 pm »
@nicole: write on what kind of system you work. No post with information about your FPC/Lazarus Version, nor is it Win 10, Win 7 or a Linux distribution.

It looks you work on Windows, but no information.

Lazarus IS NOT Delphi !!!!

Lazarus is using normal the official widgetsets of the system and this is sometimes not compatibel to all features. But it works on all major widgetsets and platforms.

BTW: On Windows you have troubles to color a widgetset Button. On Linux no Problem with the color. So you can use non widgetset Buttons like Handoko say.
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14201
  • Probably until I exterminate Putin.
Re: Button.Color - stays grey
« Reply #3 on: July 01, 2022, 10:28:16 pm »
On windows you can't change the color. Period.
But you can use TBitButton.
This is not a limitation of Pascal, it is a limitation of windows.

The only thing is: maybe the color property should be hidden on windows, because it has no function.
And confuses people.
« Last Edit: July 01, 2022, 10:31:04 pm by Thaddy »
Specialize a type, not a var.

lainz

  • Hero Member
  • *****
  • Posts: 4460
    • https://lainz.github.io/
Re: Button.Color - stays grey
« Reply #4 on: July 01, 2022, 11:31:41 pm »
Install BGRAControls, and you can style buttons, checkbox, radiobutton, combobox, labels, panels, and so on.

af0815

  • Hero Member
  • *****
  • Posts: 1289
Re: Button.Color - stays grey
« Reply #5 on: July 02, 2022, 08:30:09 am »
On windows you can't change the color. Period.
...

The only thing is: maybe the color property should be hidden on windows, because it has no function.
And confuses people.
A hidden property confuses the people more. Then they will claim - where is the property ... Delphi have this ... Bug ...

I think a better idea is, to write this in the documentation (maybe done) so you can say - RTFM
regards
Andreas

dsiders

  • Hero Member
  • *****
  • Posts: 1052
Re: Button.Color - stays grey
« Reply #6 on: July 02, 2022, 09:31:48 am »
On windows you can't change the color. Period.
...

The only thing is: maybe the color property should be hidden on windows, because it has no function.
And confuses people.
A hidden property confuses the people more. Then they will claim - where is the property ... Delphi have this ... Bug ...

I think a better idea is, to write this in the documentation (maybe done) so you can say - RTFM

https://dsiders.gitlab.io/lazdocsnext/lcl/stdctrls/tcustombutton.color.html
Preview Lazarus 3.99 documentation at: https://dsiders.gitlab.io/lazdocsnext

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: Button.Color - stays grey
« Reply #7 on: July 02, 2022, 10:55:33 am »
Install BGRAControls, and you can style buttons, checkbox, radiobutton, combobox, labels, panels, and so on.
This 'Button Colour' problem is why I started using BGRAControls - extrordinary power!
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

AlexTP

  • Hero Member
  • *****
  • Posts: 2386
    • UVviewsoft
Re: Button.Color - stays grey
« Reply #8 on: July 02, 2022, 11:12:58 am »
Consider also this component
https://wiki.freepascal.org/ATButton

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: Button.Color - stays grey
« Reply #9 on: July 02, 2022, 11:29:14 am »
Thank you for the answers and for the nice alternaties to TButton.

As you have guessed correctly: windows.
I am very new to Lazarus (coming from Delphi) and although I chose it, BECAUSE it is "write once compile everywhere", I am not aware of the many consequences of this, yet.

My next step will be to change to Linux. All is much work and starts - with a button.


PS: I just had a look at "Candy Controls": There seems to be all inside, I ever dreamed of!
(I like ATButton as well!)
« Last Edit: July 02, 2022, 11:35:07 am by Nicole »

 

TinyPortal © 2005-2018