Bevel button backcolor not working

I am trying to change the back colour of a bevel button at run time, but the following code is not working;

[code]me.HasBackColor=true
me.BackColor=rgb(255,0,0,0)[/code]

At first I thought that it was because I didnt have a value for the Alpha channel, but it makes no difference. Where am I going wrong???

if you are on OSX it does not work,
BevelButton - BackColor is Windows and Linux only

Thanks Axel, That is in the help file if I had taken the time to properly read it.

[quote=100539:@Chris Benton]I am trying to change the back colour of a bevel button at run time, but the following code is not working;

[code]me.HasBackColor=true
me.BackColor=rgb(255,0,0,0)[/code]

At first I thought that it was because I didnt have a value for the Alpha channel, but it makes no difference. Where am I going wrong???[/quote]

It does not work on Mac, but you can use this instead :

Sub Open() dim p as new picture(me.width,me.height,32) p.graphics.ForeColor=rgb(255,0,0) p.graphics.FillRect(0,0,me.width,me.height) me.IconAlign = 1 me.Icon = p End Sub

Michel solution works fine, but how to to use property Bevel like Rounded Bevel and also the backcolor in OSX ?

As far as I can see, rounded bevel works just fine when I set a BevelButton to it in the IDE. As for the backcolor, it is a bug that has not been fixed for a while. Note that using the workaround I posted will not break if and when backcolor starts to work.

Thanks Michel. I have been looking for a solution to the backcolor issue.
Hoping it all gets attention soon. Looks like it has been an issue for a long time.

<https://xojo.com/issue/8804> from 2009

Think this one will never be solved, since it’s outstanding for 7 years now. But Michel provided a working alternative above which is working on all platforms. So the workaround is simple, just subclass the bevelbutton and implement it this way.

I worked this morning with a bevelbutton, and noticed my workaround masked the button frame.

Here is the corrected code :

dim p as new picture(me.width, me.height) p.graphics.ForeColor = me.BackColor p.graphics.FillRect(0,0,p.width, p.height) p.graphics.ForeColor = &c99999900 p.graphics.DrawRect(0,0,p.width, p.height) me.IconAlign = 1 me.Icon = p

Thank you Michel! Absurd that you have to do this workaround. Why can we easily change colours and other properties in other cross-platform tools but not this one? Frustrating. Then you have to wait to open the damn solution to see the colour change take effect.

We live in an imperfect world…