Example of using mimic script to build custom pick menus
This sample program is intended to demonstrate one or more programming functions or methods and is presented as programming example only. Schneider Electric assumes no liability for the use or application of this example program or any portion thereof.
This is an example of a mimic script that builds custom pick menus. Once the script is executed, a custom pick menu would appear with 2 options: Point Control and Another Submenu. The Point Control has 3 options - to control a particular point to 0, to 10 and to 20.
In this example the script is placed on a mimic which is a part of a symbol and uses a mimic parameter instead of an actual database point. This mimic should be embedded onto another mimic and the mimic parameter called Point needs to be set in order for this script to work.
Public Sub BuildCustomMenu()
Dim objPoint, iValue
Dim Submenu1, Submenu2
Set objPoint = Server.FindObject(Mimic.Parameters.Point.FullName)
Set Submenu1 = Menu.AddMenu("Point Control")
Submenu1.AddItem("Set " & objPoint.FullName & " to 0")
Submenu1.AddItem("Set " & objPoint.FullName & " to 10")
Submenu1.AddItem("Set " & objPoint.FullName & " to 20")
Set Submenu2 = Menu.AddMenu("Another submenu")
ivalue = Menu.Display()
If iValue = 1 Then
objPoint.Interface.CurrentValue = 0
If iValue = 2 Then
objPoint.Interface.CurrentValue = 10
If iValue = 3 Then
objPoint.Interface.CurrentValue = 20