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

Capturing a key in a Jig

2 REPLIES 2
Reply
Message 1 of 3
Anonymous
806 Views, 2 Replies

Capturing a key in a Jig

 In a Jig, while it is running: I would like to
 launch a form when the user types/presses
 the "s" key.

 I have got this working, but I also have to hit
 'enter' after typing/pressing “s” to launch
 The form.  I want to be able to launch the form
 In one keystroke to be smoother, and not hit
 The enter key.  

 I am thinking I might have to additionally capture
 Keyboard events.   Anyway here is the sampler
 part of the Jig where I am dealing with this.



Protected Overrides Function Sampler(ByVal prompts As JigPrompts) _
        As SamplerStatus
            Dim doc As Document = Application.DocumentManager.MdiActiveDocument
            Dim ed As Editor = doc.Editor
            Dim JigOptions As New JigPromptPointOptions()

            JigOptions.SetMessageAndKeywords(vbLf & "Select point: [Set]: ", "Set")
            JigOptions.UserInputControls = UserInputControls.Accept3dCoordinates

            Dim res As PromptPointResult = prompts.AcquirePoint(JigOptions)

            If res.Status = PromptStatus.Keyword Then
                If res.StringResult = "Set" Then
                    MsgBox("Launch Settings Form")
                End If
            ElseIf res.Status = PromptStatus.OK Then
                If cursor_point_xy = res.Value Then
                    Return SamplerStatus.NoChange
                Else
                    cursor_point_xy = res.Value
                    Return SamplerStatus.OK
                End If
            End If

            Return SamplerStatus.Cancel

        End Function

2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: Anonymous

I know you can peek at the last keypress using GetAsyncKeyState, but the big problem you have is sinking the keypress to AutoCAD, and off the commandline. Not sure that is possible.

 

The bigger concern is that you are deviating from the "Standard" AutoCAD input methodology. I have tried in the  past to create "Unique" input methods, but the bottom line is that the end user expects AutoCAD (and thus, your add-in) to behave in a predictable manner. Think hard about altering this, as it usually just created frustration for the end user.

 

HomeBoy Out

Message 3 of 3
Anonymous
in reply to: Anonymous

Thanks for the reply,

 

My (old) original vb function did not have the

power of a vb.net jig, so I had to combine

a (grread) lsp with other functions.  Fairly

hideous.    But it worked.   So I was

trying to update/mimick the solution with net.

should be able to apply 'GetAsyncKeyState'

like you said.  Was actually working with

it earlier. 

 

Thankyou

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