Page 1 of 1

Changing a button's "Disable" property

Posted: Sun May 31, 2020 8:15 pm
by Lonnie
I want to change a button's "disable" property. When I click on one button I want to have it disable another button so it can't be selected. And when I click a 3rd button have the disabled button re-enabled.

I looked at setProp but can't get the syntax right.

Thanks,
Lonnie

Re: Changing a button's "Disable" property

Posted: Sun May 31, 2020 8:21 pm
by SparkOut

Code: Select all

set the disabled of button "theButton" to true
or false, appropriately. You can have a single button "toggle" the state with

Code: Select all

set the disabled of button "theButton" to not the disabled of button "theButton"
which will set true or false according to the opposite of what it is now (using boolean "not" to flip true/false).

"setProp" is for defining handlers that run when a particular property is set, not for actually setting that particular property. To set a property, either built-in or custom properties, just use "set".

Re: Changing a button's "Disable" property

Posted: Sun May 31, 2020 8:39 pm
by FourthWorld
In addition to setting the disable property to true or false, you can also use the "enable" or "disable" commands.

Re: Changing a button's "Disable" property

Posted: Sun May 31, 2020 10:18 pm
by Lonnie
Thanks ... I can make that work!
Lonnie