Cancel a double click
Description
Demonstrates how to receive (and in this case, cancel) a double click from a user. Run the sample code and double click a browser node to trigger the event.
Code Samples
Option Explicit
Private WithEvents oUIEvents As UserInputEvents
Private Sub Class_Initialize()
Set oUIEvents = ThisApplication.CommandManager.UserInputEvents
End Sub
Private Sub oUIEvents_OnDoubleClick(ByVal SelectedEntities As ObjectsEnumerator, ByVal SelectionDevice As SelectionDeviceEnum, ByVal Button As MouseButtonEnum, ByVal ShiftKeys As ShiftStateEnum, ByVal ModelPosition As Point, ByVal ViewPosition As Point2d, ByVal View As View, ByVal AdditionalInfo As NameValueMap, HandlingCode As HandlingCodeEnum)
Debug.Print "OnDoubleClick: "; SelectedEntities.Count; SelectionDevice; ShiftKeys; View.Caption
If SelectionDevice = kBrowserSelection Then
MsgBox "Hello there! I'm not letting you activate this"
ThisApplication.CommandManager.ControlDefinitions("AppAboutInventorCmd").Execute2 (False)
HandlingCode = kEventCanceled
End If
End Sub
Class Test
Private WithEvents oUIEvents As UserInputEvents
Sub Main
oUIEvents = ThisApplication.CommandManager.UserInputEvents
End Sub
Private Sub oUIEvents_OnDoubleClick(SelectedEntities As Inventor.ObjectsEnumerator, SelectionDevice As Inventor.SelectionDeviceEnum, Button As Inventor.MouseButtonEnum, ShiftKeys As Inventor.ShiftStateEnum, ModelPosition As Inventor.Point, ViewPosition As Inventor.Point2d, View As Inventor.View, AdditionalInfo As Inventor.NameValueMap, ByRef HandlingCode As Inventor.HandlingCodeEnum) Handles oUIEvents.OnDoubleClick
Logger.Info("OnDoubleClick: "& SelectedEntities.Count & SelectionDevice & ShiftKeys & View.Caption)
If SelectionDevice = kBrowserSelection Then
MsgBox( "Hello there! I'm not letting you activate this")
ThisApplication.CommandManager.ControlDefinitions("AppAboutInventorCmd").Execute2 (False)
HandlingCode = kEventCanceled
End If
End Sub
End Class