Exercises

<< Click to Display Table of Contents >>

 

Exercises

In this exercise, let's configure an option to copy the configurations of a pump and send them to all other pumps by using mouse's right-click.

1.Create an Internal Tag in Viewer named "CopyPump".

2.In XControl XC_Pump, select the group with a pump image and insert the next script on the MouseDown event.

If Button = 2 Then 'Right-click
  If TypeName(Application.Item("CopyPump").Value) = "Empty" Then
    Menu = "Copy"
  Else
    Menu = "Copy|Paste"
  End If
 
  optionMenu = Application.SelectMenu(Menu)
  If optionMenu = 1 Then 'Copy
    'Store information on Viewer's Tag
    Dim arr(2)
    arr(1) = XC_Pump.Source.Status
    arr(2) = XC_Pump.Source.Speed
    Application.Item("CopyPump").Value = arr
  ElseIf optionMenu = 2 Then 'Paste
    'Send information from Viewer's Tag to DataPump
    arr = Application.Item("CopyPump").Value
    XC_Pump.Source.Status = arr(1)
    XC_Pump.Source.Speed = arr(2)
  End If
End If

 

3.Save all changes and register the library.

4.Execute the application and test this new functionality.

Was this page useful?