onMouseUp event does not fire if mouse is dragged after clicking down

I have a button that is intended to write a tag to True while being held down, and then write it back to False when let go. To achieve this, intuition would suggest using the onMouseDown event to write the True value, and then onMouseUp to write the False value.

If the button is clicked without moving the mouse at all this works as expected. If you press the mouse click down, then move the mouse, and then let go the onMouseDown event will fire but onMouseUp will not. This applies whether you actually move the mouse off the button while clicked down or leave it in the bounds IF you have an image on the button, which I do. If you don’t have an image on the button it does still fire the onMouseUp event as long as you don’t move the mouse out of the bounds of the button.

Any suggestions or workarounds? Maybe a way to disable click and drag entirely?

This is expected behaviour. This allows the user to not perform the action if they pressed it by mistake (for the mouse up not triggering).

This is a bit weird, and I guess it has something to do with how Ignition embeds images into buttons?

Before going any further with this, have a good read of this thread: Very Concerning Read/Write Issues. Important information for all users

Implementing momentary presses can be hazardous depending on how they're used.

Follow up on this, if you use the onMouseOut() event instead of the onMouseLeave() event the image related failure case does not occur.