Border Width on a Perspective button

Hello,

I have a Perspective screen with several buttons with constant text field like 1,2 etc. (which display part details when clicked) and also a custom prop associated with each button to change border width when I click a button which runs a script bound to the custom prop. However, it doesn't really change the width when I switch between buttons. Not sure what's going on here. Attaching some pics here. I have inherited this project and know just basics on Ignition. PLease help.

image
image

Not sure why that isn't working, but I wouldn't use a script for this kind of thing. I would bind an Expression directly on the style properties themselves. Something like:

if({this.custom.border} = {this.props.text},
	5,
	1
)
1 Like

Try with a unit: "1px", "5px" for example.
Also, as Ryan said, use a binding.
In fact, whenever you find yourself thinking "I know, I'll use a value change script !", you should first try with a binding.

3 Likes

This sounds like a job for the Perspective - Multi-State Button | Ignition User Manual. It has a selectedStyle property which means that you don't need any script or binding.

Multistate button border

No code!

Tip: use Perspective Built-In Themes | Ignition User Manual or define your own instead of hard-coding them into properties. Its the way of the web.

3 Likes

Good catch.

Thanks for the responses! I will try these options