Button RGBA

I am unable to set the Alpha (transparency) for the background color of a button. Is this by design? I would very much like to be able to do that.

I want that in order to put a frame around an existing feature on an image (i.e. a map), and have the frame include security to control its action. I learned, for instance, that containers will not provide the security features that I want. Are there components which provide both the security and the transparency?

Thanks.

Transparency does work for the background color of a button. Choose your color in the property editor in the form r,g,b,a then hit enter. For some reason the it displays the 4th color number to 255, even though the color works correctly. Alternatively, choosing the background color of the button with a transparent color from the palette also works.

Its the 3D background effect that is clobbering your alpha channel. Turn off 3D mode (its an expert property).

Even better, ifyou want it completely transparent, uncheck “Fill Area”

Oh, I see what you mean Bruce. It reverts to a solid color and acts weird in runtime - regardless of the 3D background property setting.

Getting rid of the fill entirely certainly does its job.

[quote=“Carl.Gould”]Its the 3D background effect that is clobbering your alpha channel. Turn off 3D mode (its an expert property).

Even better, ifyou want it completely transparent, uncheck “Fill Area”[/quote]

Oh boy, expert properties!

That’s perfect. Thanks.

Related to this, is there a way to make the background color of a container transluscent? If I set the alpha to anything less than 255, it goes completely transparent. No big deal, but I found an instance where it would be nice to be able to set this. Everything else in the container works fine.

Sorry, currently the container doesn’t play nicely with semi-transparent colors due to how the opaque property is implemented.

We can fix this, but in the meantime your best bet is to take a rectangle and shove it to the edges of the container, push it to the bottom, and anchor it to all 4 sides.

Got it, thanks. I bound a slider value (range 0-255) to the alpha channel so they will be able to set it any way they want. I did it using java.awt.Color. Is there some other way that I overlooked?

	a = event.source.value
	from java.awt import Color
	event.source.background = Color(213,213,213,a)
	event.source.parent.getComponent('Rectangle').background = Color(213,213,213,a)

You can bind the background color of the rectangle to an expression like

color(r,g,b,a)

Where a is the slider’s value between 0 and 255.