I have placed a 2 State Toggle button on the main window of a sandbox application, but do not have a tag attached to the button.
I have added an event handler to the button, it is triggered by the mouse\mouseClicked event.
In the event handler script I attempt to set the value of a boolean tag as follows:
currentText = event.source.text
system.gui.messageBox(‘Mouse clicked on label “%s” at %dx%d’ % (currentText, event.x, event.y))
if “Hand-made tags/VFD Manual Start” :
system.tag.writeToTag("Hand-made tags/VFD Manual Start",0)
system.tag.writeToTag("Hand-made tags/VFD Manual Start",1)
Earlier in the day, I had attached the VFD Manual Start tag (a boolean) to the button and turned on the Confirmation. In spite of removing the binding to the tag, the confirmation still comes up at this time.
When I run the Client, I see the confirmation dialog appear in response to a left mouse click, but the message box and the printed “here” do not appear.
When the right mouse button is clicked, the message box appears, followed by the printing of “here” on the console.
On a right mouse click, the tag VFD Manual Start is assigned a value of zero, no matter the starting value of the tag.
What am I doing wrong?