Example: Create an ActiveX Event Custom Button

This example shows how to create a custom button that enables a user to view the value of a specified Point ID.

  1. 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.

  1. Enter the following.

Field

Enter

Button caption

Point Value.

Description

Message for selected alarm.

Command string

%MSG

  1. Check Fire ActiveX event.

  2. Click OK.

  3. Repeat 1-4 for either the Static or Dynamic mode, whichever still needs the button, so the button will display in both modes.

  4. Close the CIMPLICITY AMV Control Properties dialog box.

A PointValue button displays in the Button bar.

  1. Open the Properties - Object dialog box (Alt+Enter).

  2. Select Events.

  3. Configure a CustomButton event as follows.

A

Event

Select ActiveX Event.

B

ActiveX Event

Select CustomButton.

C

Action

Create a new script.

For this example:

  1. 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.

  2. 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

  1. Click OK.

  2. Test the PointView 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 Point Value.

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.

More information

CustomButton