.NET

Reply
Valued Mentor
AubelecBE
Posts: 400
Registered: ‎01-27-2010
Message 1 of 3 (213 Views)

Catching a Righ Click but Autocad got nuts

213 Views, 2 Replies
09-04-2012 05:53 AM
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

 

ADN Support Specialist
fenton.webb
Posts: 352
Registered: ‎07-24-2007
Message 2 of 3 (167 Views)

Re: Catching a Righ Click but Autocad got nuts

09-10-2012 04:27 PM 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

Developer Technical Services

Autodesk Developer Network


Valued Mentor
AubelecBE
Posts: 400
Registered: ‎01-27-2010
Message 3 of 3 (149 Views)

Re: Catching a Righ Click but Autocad got nuts

09-11-2012 03:19 AM 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...

 

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Are You Going To Be @ AU 2014? Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the Autodesk Help | Learn | Collaborate booths in the Exhibit Hall and meet our community team if you get a chance!