Page 1 of 1

Native colors for gui buttons

Posted: 03 Mar 2021, 05:37
by cdull
I wish to change the color of the font and background of a gui button within the button code (for example fc = font color and bc = background color):

Gui, Add, Button, fc000000 bc000000, Button name

I wish to see that in AHK v1 and v2.

I know there are some workarounds and i use them. But that would make all so much easier.

Re: Native colors for gui buttons

Posted: 15 Mar 2021, 22:27
by Delta Pythagorean
The best thing that I can think of to do (but not test, too lazy right now) would be to do the following:

Code: Select all

Gui, Color,, 0x000000    ; Set the color for the controls
Gui, Font, c0xFFFFFF
Gui, Add, Button, w75 h23 -Theme, Click me!
And yes, I know you use workarounds, but I would assume Lex tries to add features to AHK to help the language, not necessarily to solve a minor problem/add a "quality of life" tool here and there.

Re: Native colors for gui buttons

Posted: 19 Mar 2021, 14:27
by cdull
Your workaround looks easy, but it is not working.

I think this is a feature that helps the language. It improves the possibilitys and makes it easier.

Re: Native colors for gui buttons

Posted: 23 Apr 2021, 23:10
by SirSocks
I also think this would be a great option. I've seen many posts asking how to change the color of gui buttons. I think it would be great if there was a simple native solution.

Re: Native colors for gui buttons

Posted: 24 Apr 2021, 22:55
by lexikos
If there was a simple native solution, you would already have it. There isn't one (Win32 buttons don't support setting colours), so I would have to implement a custom solution in C++. If someone else submits a satisfactory pull request which adds this functionality, it might happen.

Scripts to add functionality are generally not workarounds for missing functionality. If a script achieves your goal, it is a solution.

Colouring buttons does not help the language.

Re: Native colors for gui buttons

Posted: 30 Jan 2023, 20:33
by DuckingQuack
Delta Pythagorean wrote:
15 Mar 2021, 22:27
The best thing that I can think of to do (but not test, too lazy right now) would be to do the following:

Code: Select all

Gui, Color,, 0x000000    ; Set the color for the controls
Gui, Font, c0xFFFFFF
Gui, Add, Button, w75 h23 -Theme, Click me!
And yes, I know you use workarounds, but I would assume Lex tries to add features to AHK to help the language, not necessarily to solve a minor problem/add a "quality of life" tool here and there.
I'm guessing there's no way to do something like this in V2?

Re: Native colors for gui buttons

Posted: 30 Jan 2023, 22:03
by boiler
DuckingQuack wrote:
30 Jan 2023, 20:33
Delta Pythagorean wrote:
15 Mar 2021, 22:27
The best thing that I can think of to do (but not test, too lazy right now) would be to do the following:

Code: Select all

Gui, Color,, 0x000000    ; Set the color for the controls
Gui, Font, c0xFFFFFF
Gui, Add, Button, w75 h23 -Theme, Click me!
And yes, I know you use workarounds, but I would assume Lex tries to add features to AHK to help the language, not necessarily to solve a minor problem/add a "quality of life" tool here and there.
I'm guessing there's no way to do something like this in V2?
Yes, but there's really no reason to do so since that didn't do what it was meant to do in v1 either and you'll get the same result (nothing) in v2. As he said, he didn't test it, and he apparently didn't realize it changes neither the background color nor the text color of the button.

Re: Native colors for gui buttons

Posted: 31 Jan 2023, 05:43
by DuckingQuack
Thank you, I misread that post.

Re: Native colors for gui buttons

Posted: 31 Jan 2023, 05:48
by boiler
I think you probably read the post correctly. It just misrepresented what was possible.