.NET

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

Catching a Righ Click but Autocad got nuts

204 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 (158 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: 384
Registered: ‎01-27-2010
Message 3 of 3 (140 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...

 

 

 

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.