Confirmation

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

6 Replies

  • I believe you can enable a confirmation in the wizard for creating a pushbutton data entry, but if not then you insert the vb messagebox function configured with ok/cancel buttons prior to the frswritevalue function in the on click sub script. If ok is returned then execute frswritevalue function else exit sub. More details if you need them. ...
  • In reply to Youssef.El-Bahtimy:

    Dear Youssef, Thank you so much. it would be highly appreciated to say me that these activities for creating this function shall be done in HMI configuration or in Control Studio? actually, I ask you to put me in correct way, I will try to use your advice in creating the function. Thanks a lot.
  • In reply to Pouya:

    Dear Pouya,
    please try in HMI.

    Private Sub CommandButton1_Click()

    Dim msg As String

    msg = MsgBox("Please Confirm Action", vbYesNo, "Confirmation")
    If msg = vbNo Then Exit Sub

    WriteValue "1", "DVSYS.YourTag/YourVariable.F_CV"

    End Sub

    Regards
  • In reply to LostEngineer0:

    Thank you so much my Friend
  • In reply to LostEngineer0:

    Great job. Consider adding error handing, like on error goto errhandler, and a :errhandler section
  • 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

    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