Initial button color doesn't match properties

When a button is initially created from the component toolbar, its appearance does not match its properties. Changing either the ‘Background 3D?’ or ‘color’ properties triggers an update that corrects this, but I have been unable to reproduce the original style using any combination of properties.

I’ve attached an example… The button on the left is created from the toolbar. This button was then copy-pasted to create an exact duplicate on the right. The ‘Background 3D?’ property of the right button was briefly toggled. Now the buttons look very different, even though they both claim to have the same properties.


colors.proj (6.59 KB)

I think we are missing some very important information :smiley:

What version of Ignition and what version of Java?

Actually, don’t worry about the versions.

I just spoke with the developer and apparently this has been a known issue for a while now. There isn’t any way for us to change this, it has to do with the way the background color is reported when the button is dropped onto the screen.

Surely you could just trigger an update of the properties when a button is placed?

I’d be interested in more technical details about this issue. What exactly is different about the default button that gives it the different appearance? Is there any way to reproduce this appearance once a button has been updated?

Thanks.

It’s a quirk of the PLAF that we use (AlloyLnF).

You see, we don’t directly set the colors on buttons, we have to go on a roundabout way to set the colors in order to maintain the 3d effect. But there is no inverse of this process, and so, a virgin button claims that it’s background color is (238,236,232), but it lies! There is some disconnect between this default value and how the LnF paints a button whose background color has never been set. Because if you actually set the background color to (238,236,232), it looks different. I’m not really sure what color you’d need to use to make the button look exactly like it does before it’s even had a color set on it.

We can change it for 7.5.4 so that the background color starts off as white, that will give a pretty close result to what the default is, but at least it’ll be consistent.

Thanks for that Carl.

White does look pretty close. The change for consistency definitely gets my vote.

There is a slight complication though… I’ve just discovered that when I reopen my test window the button on the right gets the default appearance again! I guess that the colour doesn’t get updated when it’s loading the properties because it doesn’t think they’ve changed.

I would guess that you need to set the initial colour to white when loading in buttons as well. However, this would mean that any existing buttons with the default appearance would look different after the next change. This may be something of a backwards compatibility headache.

You could leave it as it is, with the colour (238, 236, 232) being defined as magical, but that doesn’t work when the colour is set via a binding.

Any thoughts?

Alright, I’ve got it. Color (251,250,249) should be the starting color instead of white. This should be repeatable and not affect backwards compatibility.

Excellent.

Thanks once again Carl.