Event script, 2 state toggle button

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)
else :
system.tag.writeToTag("[]Hand-made tags/VFD Manual Start",1)
print “here”

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?

The confirmation box is simply a property of the 2 state button that shows that message confirmation box based on its boolean value, and it doesn’t matter if its bound to a tag or not.

When you put a script in the mouseClicked event, it needs for the press and release to happen in the same spot. The confirmation message box happens right in the middle of the event structure, so our code detects the press and release in different locations. To fix this, you can use mousePressed instead.

As far as the script itself, the script won’t behave the way you want because this always evaluates to “true”:

if "Hand-made tags/VFD Manual Start":

If you want to get the value from the tag you have to use system.tag.getTagValue(“Tagpath”):

if system.tag.getTagValue("Hand-made tags/VFD Manual Start"):

Thanks for the response, James. I’m new at Ignition, so I apologize for the dumb questions.

My confusion with the Confirmation dialog was due to the Basic filter being in effect; once I switched to All, I could see the Confirmation in the property window and turn it on/off.

I think I am clear now about the way to obtain the value of a tag (system.tag.getTagValue).

One question remains from yesterday’s post: why does the Confirmation dialog swallow up the left mouseClick event?
And a new question for today: I’m experimenting with the tabStrip and finding that a single left-click on a tab causes the windows to swap but a second left-click is required before the tab is rendered in the “selected” fashion (i.e., highlighted). Why would this be? Is there a setting for this that I’m not seeing?

It’s not that the confirmation box bypasses the mouseClicked event, it just returns a different location for mouseReleased than mousePressed, and the prerequisite for a mouseClicked event is that those two be in the same location. Putting your code under mousePressed or mouseReleased will fix this problem.

As for the tab strip issue, it’s always a good idea to make a new thread for each issue you have so we can keep things organized and respond to issues quicker. Thanks :thumb_right: