Dear All
in HMI page, I want to use a pushbutton as toggle for giving 1 or 0 to a parameter in control studio. it is simple and possible. but when we push pushbutton, before set value, we want to have a confirmation box that after confirmation, the value to be set. may I ask you please say me, how can I make this kind of function in HMI?
Best regards
Pouya
In reply to Youssef.El-Bahtimy:
In reply to Pouya:
In reply to LostEngineer0:
In DeltaV Live (DeltaV 14.LTS +) you could add some TypeScript code on a Button by selecting "Custom Script" Action under the Basics/Button properties.
(Note: You could also add a script to another object or group by going to the interaction tab and adding the OnClick interaction.)
Here is an example script for a GEM Yes No action pop up that will close out with a No response after 20 seconds.
var response
var strOnOff
var valCV= (await DLSYS.ReadAsync(Gem.Tag+'/YOUR_PARAMETER.CV')).Value // Read in current Value
var valCV= (await DLSYS.ReadAsync(Gem.Tag+'/YOUR_PARAMETER.CV')).Value // Rea
valCV == 0 ? strOnOff= "Turn On?" : valCV == 1 ? strOnOff= "Turn Off?" : strOnOff="Error in GEM Tag Assignment. Please contact Engineering" // Write message for popup
response = await DL.MessageBoxAsync(strOnOff, "Warning!", Constants.MessageBoxButtonType.MB_YESNO,20) // Popup called
if(response==Constants.MessageBoxReturn.IDYES) // Yes Selected
{
WriteAsync(Gem.Tag+'/SP_PARAMETER.CV', valCV== 0 ? 1 : valCV== 1 ? 0 : valCV) // Action dependent on current state
}
Note 1: Add a DLSYS. in front of the WriteAsync() function. The EE365 Forums wouldn't let the post go up with that function written out.
Note 2: For a context display replace Gem.Tag w/ Dsp.Tag. For a one off button replace Gem.Tag+' with tag path info. The "Tag" GEM parameter will need to be added and configured on the GEM for this script to work.
Ben Merryman