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
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
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