How to change background color for button during runtime?

When I try to change button background color by, for example,
MyDialogue.GetControl(“MyButton”).getModel.BackgroundColor = RGB(200,200,200)
the button doesn’t change its color. Button’s borders get new color only.

On Linux try this for your dialog:

MyDialogue.getPeer().setProperty( “NativeWidgetLook”, False )

@musikai Thanks for the code. Works for me.


Please specify OS & LO version when posting.

In testing (Mint 18.3 with LO v6.1.0.3), I get no change at all - not even border. Can change dialog background though.

Went in to original dialog & set background color for buttons (3 on my test) & in desing mode they are colored in but have no color when the dialog is run.

This is a Bug & you should report it. Did a quick review and did not see one specifically for this.