Label Border Property on Vision screens on mouseEntered Event

I have created a popup screen in Vision with selectable labels and want there to be an outline when the user hovers over the label they wish to select. I attempted to use the mouseEntered event along with the Set Property script builder. However, the Set Property is looking for a value to send to the label's border. It does not accept numerical values or strings like "Line Border".

Is there a list somewhere of acceptable values or is there an easier way of going about this?

Have your mouse entered/mouse exited events simply set a custom property with a Color type. Use toBorder in an expression binding on the border property to bring in the custom color.

It looks like with the toBorder you will need more than just the color if you were to use for example toBorder(line; color; thickness). I am getting an error because the Color class cannot accept both values.

Your expression would be something like:
toBorder("line;" + {Root Container.Text Field.borderColor} + ";2")

Kapture 2022-11-07 at 12.09.17

2 Likes

That works! Thank you very much. I just changed the default color to the background, so it only appears when mousing over. Just to pick your brain is there a way to add padding in the box?

Not without getting a fair bit more involved. You can create borders with scripting, which would be more ultimately flexible, but may be harder to reason about.
See: BorderFactory (Java SE 11 & JDK 11 )

So creating a border with padding is usually accomplish (in Java Swing) by creating a 'compound' border; you can use an 'empty border' as part of the compound border to add padding, and whatever border style you want for the other half of the compound border.