.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Catching a Righ Click but Autocad got nuts

2 REPLIES 2
Reply
Message 1 of 3
AubelecBE
501 Views, 2 Replies

Catching a Righ Click but Autocad got nuts

Private Class JigFilter
        Implements System.Windows.Forms.IMessageFilter

        Private  WM_LBUTTONDOWN = As Integer = &H201
        Private WM_LBUTTONUP As Integer = &H202
        Private WM_RBUTTONDOWN As Integer = &H204
        Private WM_RBUTTONUP As Integer = &H205



        Public Function PreFilterMessage(ByRef m As System.Windows.Forms.Message) As Boolean _
                         Implements System.Windows.Forms.IMessageFilter.PreFilterMessage
            If m.Msg = WM_RBUTTONDOWN Then
                'Dim doc As Document = Application.DocumentManager.MdiActiveDocument()
                'Dim ed As Editor = doc.Editor()
                'ed.WriteMessage(vbCrLf + "Right Button pressed!!")
                If _toggleRotation = False Then
                    _toggleRotation = True
                    _posRotation = _position
                Else
                    _angle = Entite.Rotation
                    _toggleRotation = False
                End If
                Return True
            End If
            Return False
        End Function

    End Class

 He all.

I use a code for catching the right click mousse.

 

It work fine in my computer but i have installed on other Pc and when right click  occur autocad launch  a other command...   The command is random....

I dunno why ??

 

here the code New and the Run of my jig.

 

 '*************************************
    '**** SUB NEW ************************
    '*************************************
    Sub New(ByRef Doc As Document, ByRef tr As Transaction, ByRef db As Database, ByRef ent As Entity)
        MyBase.New(ent)

        Entite = Entity
        _filter = New JigFilter

        System.Windows.Forms.Application.AddMessageFilter(_filter)

        _Doc = Doc
        _db = db
        _tr = tr
        _angle = 0

        _txtSize = 12 
_alignH = TextHorizontalMode.TextCenter _alignV = TextVerticalMode.TextVerticalMid _toggleRotation = False _toggleBold = False _toggleItalic = False Update() End Sub

 

 '*************************************
    '**** FONCTION RUN *******************
    '*************************************
    Public Function Run() As PromptStatus
        Dim stat As PromptStatus = PromptStatus.Keyword
        'While (stat = PromptStatus.Keyword)
        Do While (stat = PromptStatus.Keyword)
            Dim promptResult As PromptResult = _
                _Doc.Editor.Drag(Me)
stat = promptResult.Status Loop 'Raz eventHandler System.Windows.Forms.Application.RemoveMessageFilter(_filter) _filter = Nothing Return stat End Function

 

2 REPLIES 2
Message 2 of 3
fenton.webb
in reply to: AubelecBE

It might be easier to create a new Editor.PointMonitor

 

Editor ed =

      Application.DocumentManager.MdiActiveDocument.Editor;

    ed.PointMonitor +=

      newPointMonitorEventHandler(ed_PointMonitor);

 

and watch for the right click via the History property...?




Fenton Webb
AutoCAD Engineering
Autodesk

Message 3 of 3
AubelecBE
in reply to: fenton.webb

thank. I dont know how to use event handler.

I must learn this..

 

i changed the mouse click with key - and + and using this :

http://through-the-interface.typepad.com/through_the_interface/2012/09/a-handy-jig-for-creating-auto...

 

 

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost