This example shows how to create a custom button that enables a user to view the value of a specified Point ID.
Open a Button Caption dialog box for a Custom Button in the CIMPLICITY AMV Control Properties dialog box.
Note: The mode on the Buttons tab can be Static or Dynamic.
Enter the following.
Field |
Enter |
Button caption |
Point Value. |
Description |
Message for selected alarm. |
Command string |
%MSG |
Check Fire ActiveX event.
Click
.Repeat 1-4 for either the Static or Dynamic mode, whichever still needs the button, so the button will display in both modes.
Close the CIMPLICITY AMV Control Properties dialog box.
A
button displays in the Button bar.
Open the Properties - Object dialog box (Alt+Enter).
Select Events.
Configure a CustomButton event as follows.
Event |
Select ActiveX Event.
ActiveX Event |
Select CustomButton.
Action |
Create a new script.
For this example:
Copy the PointGet (function) script example from the Basic Control Engine documentation into the Script editor to create message boxes that will display the value for a specified point.
Include the ButtonString parameter value in the message.
The script is as follows.
Sub OnCustomButton(ButotonNumber As Long, ButtonString As String)
MsgBox "Value is " & PointGet(InputBox$("Enter Point Id") ) & ebCRLF _
& "ATTENTION: = " &ButtonString
End Sub
Click
.Test the
button.Result: When a user clicks Point Value, a message box displays for a Point ID; the specified point ID value and the alarm message are returned.
A |
Click .A BasicScript message box opens. |
B |
Enter a Point ID in the message box field. |
C |
A Basic Script message box displays the: Point value. Message for the selected alarm. |
CustomButton |