Select default value for InitializeUserInput when user presses Enter

Select default value for InitializeUserInput when user presses Enter

Anonymous
Not applicable
526 Views
2 Replies
Message 1 of 3

Select default value for InitializeUserInput when user presses Enter

Anonymous
Not applicable
I'm using the following code to set some options and I would like to know how to select a default value when the user presses enter as many other AutoCAD commands allow.

ThisDrawing.Utility.InitializeUserInput 1, "A S"
TempVal = ThisDrawing.Utility.GetKeyword("Current Area Type [Acre/Sf] <" & AreaString & ">: ")

If Err.Number = -2147352567 Then Exit Sub

Select Case UCase(TempVal)
Case "A"
CurrentAreaType = AreaType.acre
Case "L"
CurrentAreaType = AreaType.sf
End Select

I tried appending the the carriage return character on to the string like:

"A S" & chr(13)

but this did not work. Thanks for any suggestions.
0 Likes
527 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
The AutoCAD command line processes and enter as a "" string (otherwise empty string). Plus users tend to use " " as a way of pressing enter (space bar). When I want to process a command for using enter as a keyword for a default value, I make 2 more keywords: ""; and " ". Then all is well.



jvj
0 Likes
Message 3 of 3

HJohn1
Advocate
Advocate
This is the .NET disc. group and you are talking about VBA. If you are trying to convert this code to .NET, then look into the Autodesk.AutoCAD.EditorInput.PromptKeywordOptions class. It has a collection of keywords and the collection has a Default property as well.
Hope it helps.
0 Likes