How to choose position of getstring edit box

How to choose position of getstring edit box

Anonymous
Not applicable
1,051 Views
8 Replies
Message 1 of 9

How to choose position of getstring edit box

Anonymous
Not applicable

Hello,

With the following code using GETSTRING I can show the user an input box for text entry.

The question is: How can I decide which position in the drawing this text edit box appears ? I would like to be able to pass a geometry.point3d as a parameter pbut I do not find where to pass thisparameter.

Thanks for your help.

 

myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument

myDB = myDWG.Database

myEd = myDWG.Editor

 

PSO.AllowSpaces =

"EnterStringA")> Public Sub EnterStringA()Dim myDB As DatabaseServices.DatabaseDim myDWG As ApplicationServices.DocumentDim myEd As EditorInput.EditorDim myPSR As EditorInput.PromptResultDim PSO As New EditorInput.PromptStringOptions(vbCrLf & vbTab & "Enter MText text")True

myPSR = myEd.GetString(PSO)

MsgBox(myPSR.StringResult)

0 Likes
1,052 Views
8 Replies
Replies (8)
Message 2 of 9

Hallex
Advisor
Advisor

Take a look at this page

http://docs.autodesk.com/ACD/2010/ENU/AutoCAD%20.NET%20Developer's%20Guide/index.html?url=WS1a919382...

 

~'J'~

_____________________________________
C6309D9E0751D165D0934D0621DFF27919
0 Likes
Message 3 of 9

Anonymous
Not applicable

Sorry but I find no information in the link you provide

0 Likes
Message 4 of 9

Anonymous
Not applicable

Please, anybody knows how to place the edit box of getstring in a specific point ?

 

Thanks

Jose Maria

0 Likes
Message 5 of 9

Anonymous
Not applicable

Sorry I do not have VS installed on this computer or the ObjectARX download so I am going off of memory.

 

I thought the GetString method returned the string from the command prompt.

 

What edit box are you talking about?

 

0 Likes
Message 6 of 9

kerry_w_brown
Advisor
Advisor

 

Do you mean the input box  when dynamic input is active

ie the prompt box that opens at the cursor location ??


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 7 of 9

Anonymous
Not applicable

>What edit box are you talking about?
>Do you mean the input box  when dynamic input is active>ie the prompt box that opens at the cursor location ??

 

Yes the inbut box of getstring opens at cursor location. So I suppose that if I change cursor location I will be changing the position of this input box, which is what I want.

 

The problem is I don't know how to choose cursor location. So the question could be rewriten: How can I change cursor location ?

 

To better explain what input box I am referring to, you can copy and paste the following routine which asks for a string and then it shows the string in a message box:

 

Thanks for your help

Jose Maria

 

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput 'añadido
Imports Autodesk.AutoCAD.Windows 'añadido
Imports Autodesk.AutoCAD.ApplicationServices


    <CommandMethod("EnterStringA")> Public Sub EnterStringA()
        Dim myDB As DatabaseServices.Database
        Dim myDWG As ApplicationServices.Document
        Dim myEd As EditorInput.Editor
        Dim myPSR As EditorInput.PromptResult
        myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
        myDB = myDWG.Database
        myEd = myDWG.Editor
        Dim PSO As New EditorInput.PromptStringOptions("Enter String")
        PSO.AllowSpaces = True
        myPSR = myEd.GetString(PSO)
        MsgBox(myPSR.StringResult)
    End Sub

 

 

0 Likes
Message 8 of 9

kerry_w_brown
Advisor
Advisor

 

Your code will NOTshow an 'input box' if the user does not have dynamic input toggled on.

If you want to use an input box your best solution is to write one using the Forms namespace classes.

 

 


// Called Kerry or kdub in my other life.

Everything will work just as you expect it to, unless your expectations are incorrect. ~ kdub
Sometimes the question is more important than the answer. ~ kdub

NZST UTC+12 : class keyThumper<T> : Lazy<T>;      another  Swamper
0 Likes
Message 9 of 9

Anonymous
Not applicable

In response to:

> Your code will NOTshow an 'input box' if the user does not have dynamic input toggled on.

 

So I suppose the user has dynamic input on because when I run the command EnterStringA I get an input box requesting a string. You can try that yourself by copying and pasting the code below. The only problem is that I don't know how to choose the position of this input box.

 

Given the fact that the input box seems to appear where the cursor was, maybe the solution is to change the cursor position. The problem is I don't know how to change cursor position either.

 

Imports Autodesk.AutoCAD.Runtime
Imports Autodesk.AutoCAD
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput 'añadido
Imports Autodesk.AutoCAD.Windows 'añadido
Imports Autodesk.AutoCAD.ApplicationServices


    <CommandMethod("EnterStringA")> Public Sub EnterStringA()
        Dim myDB As DatabaseServices.Database
        Dim myDWG As ApplicationServices.Document
        Dim myEd As EditorInput.Editor
        Dim myPSR As EditorInput.PromptResult
        myDWG = ApplicationServices.Application.DocumentManager.MdiActiveDocument
        myDB = myDWG.Database
        myEd = myDWG.Editor
        Dim PSO As New EditorInput.PromptStringOptions("Enter String")
        PSO.AllowSpaces = True
        myPSR = myEd.GetString(PSO)
        MsgBox(myPSR.StringResult)
    End Sub

 

 

0 Likes