Changing a button's "Disable" property

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Lonnie
Posts: 29
Joined: Thu Apr 23, 2020 7:54 pm

Changing a button's "Disable" property

Post by Lonnie » Sun May 31, 2020 8:15 pm

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

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Changing a button's "Disable" property

Post by SparkOut » Sun May 31, 2020 8:21 pm

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".

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10049
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Changing a button's "Disable" property

Post by FourthWorld » Sun May 31, 2020 8:39 pm

In addition to setting the disable property to true or false, you can also use the "enable" or "disable" commands.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Lonnie
Posts: 29
Joined: Thu Apr 23, 2020 7:54 pm

Re: Changing a button's "Disable" property

Post by Lonnie » Sun May 31, 2020 10:18 pm

Thanks ... I can make that work!
Lonnie

Post Reply