Object: Events
- Updated2024-09-12
- 2 minute(s) read
DIAdem VIEW > Objects > View > Object: Events
Object: Events
The Events object provides the user commands assigned to an event in DIAdem VIEW. DIAdem saves the Events object in the VIEW layout file.
| Note To test the example script, you must first save the script and register it as a user command in the dialog box that opens when you select Settings»Extensions»User Commands. |
The following example executes the user command MyOnShowingContextMenu as soon as you open the context menu in DIAdem VIEW. The user command deletes the existing items in the context menu and adds two new items. When you select a context menu item, the example executes the MyOnContextMenuPointSelected user command, which displays the selected item in a message:
| VBScript | Python |
Call AddUserCommandToEvent("View.Events.OnShowingContextMenu", "MyOnShowingContextMenu") Call AddUserCommandToEvent("View.Events.OnContextMenuPointSelected","MyOnContextMenuPointSelected") Sub MyOnShowingContextMenu(oArea, oMenuPoints) Call oMenuPoints.RemoveAll Call oMenuPoints.Add("MyMenuPoint1", 1) Call oMenuPoints.Add("MyMenuPoint2", 2) End Sub Sub MyOnContextMenuPointSelected(oArea, oMenuPoint) Select Case oMenuPoint.ID Case 1 Call MsgBoxDisp("MyMenuPoint1 selected") Case 2 Call MsgBoxDisp("MyMenuPoint2 selected") End Select End Sub
| Note Use the AddUserCommandToEvent command to assign several user commands to one event. Use the RemoveUserCommandFromEvent command to delete a single user command from a list of user commands which you assigned to an event. Assign an empty string to an event so that the event is no longer assigned to a user command. |
Properties
OnActiveSheetChanged | OnContextMenuPointSelected | OnCursorChanged | OnDblClick | OnDrop | OnDropAllowed | OnLegendClicked | OnShowingContextMenu