Button Press Confirmation

If a BUTTON object is bound to a TAG, and you have a simple confirmation pop up assigned to button.

What is the flow of events?

Meaning - Button gets presses - confirmation windows pops up and the user selects NO - popup windows disappears - and NOTHING HAPPENS.

OR

Button gets pressed - confirmation windows pops up and the user selects YES - popup windows disappears - And the Button event is triggered.

Is this automatic or do I have to do scripting for this to work?

Thanks

That depends a whole lot on what the button is intended to do.

I know of no way to assign a confirmation pop up to a button, out side of Action Qualifiers for navigation buttons. In that case you would need to no nothing less than configure the button for the proper navigation and enable the confirmation.

Something about your post feels like this isn’t just a simple navigation button though, so really we will need a bit more information.

How is the button bound to the tag?

If you’re using the one-shot button and it’s ‘confirm’ property, then the latter is true: after the confirmation popup is interacted with, if the result is true, it will trigger a value change on the button, which will then cascade through the binding system into a tag write.

If you’re using any other button type, you would need to script this behavior yourself. Take a look at system.gui.confirm() if you’re not sure how to do this.

Ok, sorry for not being more detailed.

I am using a “Momentary” button, now under scripting “Mouse click event” (See picture) I have it setup to just confirm this action.

So my question is. Does the way I have it setup now - if the confirmation is Yes the momentary button will trigger?

If confirmation is NO then nothing happens?

Is this correct?

Thanks

The popup will break the Momentary Button, as the mouse release will happen as soon as the popup claims focus.

So the Momentary Button click event will still trigger? (It’s just being paused until the pop up closes)

So I will have to write script to skip the mouse click event if NO?

Am I on the right track?

You can’t use the Momentary Button with a confirm popup in an event script. Consider not using confirm popups at all – if you need two stages, have the first stage enable another button for the second stage.

Thanks for that tip, could you provide a simple example to help get me started?

Thanks

Something like the below–tapping anywhere in the outline around numbers toggles visibility of the flyout with RESET button:
image
This replaced a reset button that was always visible and used system.gui.confirm. The replacement is just as effective at avoiding accidental actions and a lot slicker (though admittedly slightly more work to program). Setup the flyout to set event.source.visible = False on componentRunning so it always starts out hidden in Client without hiding it in Designer before save/publish.

The above could also be done with an always visible reset button that displayed an “Are you sure?” flyout with yes and no buttons, but the above example was clear and less cluttered in this use case.

1 Like

Thanks to everybody for the help. Just a little more please.

I think this is what Pturmel was suggesting or at least something like.

I now have a button that opens a POPUP window and on the popup window i use the momentary button labeled “Confirm” when pressed it triggers and closes the popup. I also have just another simple button labled “NO” that when pressed it just closes the popup.

My problems is I want the popup window to open at a specific location and I have that set under its parameter settings. I also have unchecked “Open in Center” of the mouse clicked event for the button that calls the popup window. But for some reason it will not open on top of a “Container” that I want to hide when the popup has focus.

The container is at location 834 x 298 and I can set the popup windows to that same location but it will not be on top of that container when it opens. (It’s not even close.)

Can anyone maybe suggest what I’m missing.

If you want to use a popup window, some of the topics here may help: http://forum.inductiveautomation.com/search?q=popup%20window%20location.

Otherwise you could just show/hide a container with what you’d have in the popup window.

2 Likes

I’d absolutely recommend a quick confirmation like this going into an easily-positioned container, like witman says; the default is the center of the screen, and modifying it means all kinds of painful translations between internal DPI vs screen DPI, upper-left corner of the window vs the viewport, etc. Dealing with all of that is just setting yourself up for unnecessary pain if you can make it part of the window, as his screenshot very eloquently demonstrates.

1 Like

I like the way you have done this, but correct me if I’m wrong!

Doing it this way does not eliminate the rest of the screen from User action.

Once a button has been presses and confirmation is needed, nothing else can be done until the confirmation has be fulfilled. This is how I need it to be.

Thanks, I welcome all suggestions.

One way to block access to other components is cover the whole screen with a rectangle with no outline and fill with zero alpha value (or higher alpha value if you want to obscure the background).
image
Don’t choose none for fill (it won’t capture click events).

Program any events that would be captured by background controls with pass in rectangle to catch the events and do nothing with them.

Confirmation container goes above the rectangle.

Then you should use the one-shot button, not the momentary button, as suggested above. Blocking all interaction cuts off the momentary button.