Is there any way to change the color of a button on Xojo for Windows?

I’d like to make the background color of my button either dark blue or maybe have a backdrop. Are either of these possible using Xojo? How do I do it if it is?

Thanks!

yup… build your own button using a Canvas :slight_smile:

I did it the lazy way: I used a rectangle and the MouseDown event. Works like a charm for me but YMMV as I was building a touch enabled app. Still, I don’t see why it wouldn’t work for pretty much anything. You can see what it looks like here. You really can’t tell it’s not a button, especially from a mobile UI)

Hey Dave, for those of us who want to do it the ‘right way’ instead of the ‘lazy’ way, do you have any info on building new controls using the canvas?

I’m using WIN7 and Xojo 2016R3. Try using a “bevel button”

Near the bottom of the “Inspector” choose “HasBackColor” ON.
Then just below that select “BackColor” and choose a color until your heart is content.

Last time I checked, I was not able to change the Rectangle color. Did I miss something ?

[quote=308183:@Steve Kelepouris]I’m using WIN7 and Xojo 2016R3. Try using a “bevel button”

Near the bottom of the “Inspector” choose “HasBackColor” ON.
Then just below that select “BackColor” and choose a color until your heart is content.[/quote]
Might work for Win but not for macOS

Rectangle1.FillColor=&cff0000

Indeed, because BevelButton is buggy on Mac. The solution is easy, though : create an icon picture of the proper color and add it to the BevelButton. It is even cross platform :wink:

Wow! So this is something that works exactly as it should, but only for Win and not on MacOS?

That’s a change - think I’d better go have a lie down :slight_smile:

I think BevelButton.BackColor never worked in OSX

from LR

[quote]Controls and classes implementing the BackColor property
BevelButton Windows and Linux only New in 2009r4[/quote]

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

I just checked, it works in HiDPI as well.

So … we can just subclass the bevelbutton, give it a color property and have it conditionaly build in for osx. Agreed Michel ?

On older versions of OSX, some of the bevels have the drop shadow off one pixel in the produced app as well. I had to give up on it.

Indeed, you can perfectly well have an if TargetmacOS where you use the workaround, and otherwise, use the normal color property.

As this is a windows related thread, just be aware that BevelButton is not an actual windows button control, its a rendered button created by the framework so it wont necessarily conform to windows standards in terms of look/feel as it doesn’t at this time.

I recently switched to my own Canvas based button to get transparency, but the Bevel was fine for quite a while.

How do you consider it does not comply to this :
(from UWP design guidelines) :

[quote=308684:@Michel Bujardet]How do you consider it does not comply to this :
(from UWP design guidelines ) :[/quote]

I’ve not tried UWP on Xojo yet.

I was referring to the following:

The new UWP design guidelines should be considered the equivalent of the Mac HIG guidelines.

No matter the framework, this is the recommended look and behavior for Windows apps today.

i assume u put a label on top of the rectangle and set the label to transparent.

[quote=308752:@Michel Bujardet]The new UWP design guidelines should be considered the equivalent of the Mac HIG guidelines.

No matter the framework, this is the recommended look and behavior for Windows apps today.[/quote]

I’ve read your thread on your entry onto the windows store, congratulations btw!

Do you use a particular control type/setup to get the uwp layout as I can’t seem to see a drop on control that has that design?