Home > Enterprise >  Class not showing onMouseClick Event
Class not showing onMouseClick Event

Time:11-08

I am trying to get onm ouseclick event in my Class which I am writing to get user interaction and capture the click on the screen to get the coordinates

The options which I see for m_mouse are Terminate, suspend, Resume and Help only Might be a simple thing.

MouseClick Event was working but now not working

More information : I am trying to get mouseclick in Autodesk Inventor (3D modeling) software application in the drawings interface

Public Class Cls_GetDrawingPickPoint
    Private WithEvents m_interaction As Inventor.InteractionEvents
    Private WithEvents m_mouse As InteractionEvents
    Private m_position As Point2d
    Private m_button As MouseButtonEnum
    Private m_continue As Boolean

    Public Sub New()
    End Sub

    Public Function GetDrawingPoint(Prompt As String, button As MouseButtonEnum) As Point2d

        m_position = Nothing
        m_button = button

        ' Start selection.
        m_interaction = g_inventorApplication.CommandManager.CreateInteractionEvents
        m_mouse = m_interaction.MouseEvents

        m_interaction.StatusBarText = Prompt
        m_interaction.Start()

        Do While m_continue
            g_inventorApplication.UserInterfaceManager.DoEvents()
        Loop


        m_interaction.Stop()
        GetDrawingPoint = m_position
        Return GetDrawingPoint

        'Debug.Print("GetDrawingPoint: " & GetDrawingPoint.X & "," & GetDrawingPoint.Y)


    End Function

    Private Sub m_mouse_OnMouseClick(button As MouseButtonEnum, ShiftKeys As ShiftStateEnum, ModelPosition As Point, ViewPosition As Point2d, View As Inventor.View) Handles m_mouse.OnMouseClick
       If button = m_button Then
        m_position = g_inventorApplication.TransientGeometry.CreatePoint2d(ModelPosition.X, ModelPosition.Y)
        Debug.Print(m_position.X & "," & m_position.Y)
        End If

        m_continue = False
        ' MsgBox("Mouse clicked: " & m_position.X & "," & m_position.Y)

    End Sub


    Private Sub m_interaction_OnTerminate() Handles m_interaction.OnTerminate
        m_continue = False
        m_interaction.Stop()
    End Sub

    Private Sub m_interaction_OnActivate() Handles m_interaction.OnActivate
        m_continue = True

    End Sub


End Class

CodePudding user response:

It appears that the actual object is type MouseEvents, which inherits InteractionEvents, and OnMouseDown is a member of that type. The m_mouse field needs to be declared as that type in order to access members of that type.

  • Related