We have a Pushbutton that we are binding the “Enabled” property to a Supervisor Login. When Login is true, the button becomes enabled and the user is allowed to click on it. When Login is false, the button grays out and the user should not be able to click on it. The actions of the button are using the mouseClicked Event Handler system.tag.writeToTag.
The button is grayed out showing it as “disabled”, but we can still click on the button and it will perform the Event Handler code. Is the Enabled Property only for other properties or should it be controlling the Event Handlers too?
The event handling code runs whether or not a component is enabled. In your logic for the event handler you should check to see if it’s enabled or disabled and branch from there.
Great - that’s good to know. Is there a reason the Event Handlers can not be disabled by that property? Is that something that anyone else has requested for a new Ignition release? Or is there a specific reason for Disabling the object, but allowing Event Handlers to still function?
Well, one example might be if you wanted to have right-click bring up a menu that let you, say, log in an admin or put in a password that enabled the button.
The actionPerformed event is coupled to the button being enabled or disabled, however.