Is there any inbuilt way to provide an "are you sure?" type confirmation dialog before firing actions, like there is in the Vision module? I'm assuming that I can't just use the same if system.gui.confirm('Are you sure?') script as vision - is there an equivalent way of achieving the same thing in perspective?
I can make my own confirmation popup, of course, and pass parameters in and out to achieve what I want, but I thought there might be an inbuilt way to do it already.
Jeez, I hope not! And probably not possible – at least not as a modal dialog, due to the limits of browser environments.
I don’t permit any use of confirm() or messageBox() in any of my Vision projects. It’s easy enough to have a two-step workflow without any popup – just have step #1 enable the button(s) for step #2.
Fair enough - you’re right that it’s easy enough to make it a two-step process, and I’m not hugely concerned whether the confirmation step is a popup, a second view, or whatever. I just don’t want someone to pick up the iPad from the wrong corner and shut down the machine mid-batch. I can’t see any inherent “confirm action” option in the component events in perspective, so assumed I’d have to make my own two-step process one way or the other - but so much of my experience with Ignition up until now has been “oh, I don’t need to build that after all, Ignition has three built-in ways of achieving that result!”. So thought I’d just make sure I wasn’t missing it somewhere! With the documentation still a work in progress, it’s easy to miss features
A lot of that is the ten or more years of solving problems for customers we've built up. Perspective definitely isn't there yet, but that's definitely where we would like it to be.
With the engagement of the developers being what it is I have no doubt Perspective will get there before too long! Every time I have to deal with tech support from the other big players it makes me just want to give up and redo entire SCADA platforms with Ignition
I ran into the same issue, and found using a message handler works really well.
I create a small view to use as my pop-up box. This consists of a few labels and 2 buttons.
On the confirm button onActionPerformed event I call: system.perspective.sendMessage(msg).
The message handler is on the original view that called my pop-up and does all the work, and then closes. The name of the message handler can be hard coded, or passed into the confirmation view.
From the user perspective it looks and functions like a modal confirmation box, but all the functionality is contained in the originating view.
I used one-shot button and used a tag this is updated every 1 min ,then after I click on the one-shot button, the value change from 0 to 1 and when the tag updates it returns it again to 0.
as u see below
On confirm, a function will be called, The function can be a direct reference or functionPath and it also accepts parameters to be passed in for the function.