Call us! 512-349-0334 or (877) INDUSOFT

How to Build and Modify Custom Confirmations for CheckBox Objects in InduSoft Web Studio

Many InduSoft Web Studio users don’t know that they can require a confirmation when checking or unchecking a check box in their HMI application.  The simplest method for creating a confirmation is simply selecting the feature in the configuration popup:


However the dialog that is returned when using it is somewhat simplistic and uninformative:


This popup is simply a message box, which is a Windows System Object. There are two ways that you can change the confirmation action when using the Checkbox Object.

1) Use the translation feature of IWS to change the message. Simply use the correct message in place of the “Confirm?” (Source) row in the translation table, and the correct message will be displayed when you change the language that you modified in the translation table (It can even be the default English-1033. Any blank fields in the “Target” language will use the “Source” column defaults). You can see an example of how the translation feature operates in the project included with the IWS installation. Simply click on the flag to change languages. The translation.trn file can be edited with Excel. It is located in the \web folder of the project.

Here is an example:


With the result:


But the problem is that there is only one confirmation, and requires a message that will cover both checking and unchecking the box.  Here is an alternative:

2) You can create a custom message box (with all the usual expected features) for the checkbox by adding a Command Animation to the object. (Graphics Tab -> Animations Section). Next take the tag that you were using (it must be an integer or you will get an error if you are using tri-state. Note that “tri-state” gets selected using a second check box in that configuration) and put the tag into the Advanced -> Feedback field. This field will return its current state of False (0), True (1 or whatever value is in the “True” field), or Tri-State (2 or whatever Tri-State value is in the field) to the integer tag when the checkbox is clicked on.

Next, paste this script into the “On Down” Script of the Command Animation in order to observe the functionality of the message box that I described [assuming “$MyTag” for this example]:

Dim res
If $MyTag = 0 Then
res = MsgBox(“Are you sure you want to check?”, vbYesNo + vbExclamation, “Checking?”)
If res = vbYes Then $MyTag = 1
res = MsgBox(“Are you sure you want to uncheck?”, vbYesNo + vbExclamation, “Un-Checking?”)
If res = vbYes Then $MyTag = 0
End If

Here is the result:


Notice that the Title can be changed using this method as well as displaying the vbExclamation symbol.

There are other ways that you can configure the MsgBox object as well. You can see them here (as well as other VB tutorial websites)

Comments are closed.