.NET

Reply
Contributor
rebarwin
Posts: 13
Registered: ‎05-31-2010
Message 1 of 9 (417 Views)

How to choose position of getstring edit box

417 Views, 8 Replies
10-06-2010 09:45 AM

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)

*Expert Elite*
Hallex
Posts: 1,569
Registered: ‎10-08-2008
Message 2 of 9 (411 Views)

Re: How to choose position of getstring edit box

10-06-2010 09:57 AM in reply to: rebarwin

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
Contributor
rebarwin
Posts: 13
Registered: ‎05-31-2010
Message 3 of 9 (403 Views)

Re: How to choose position of getstring edit box

10-06-2010 10:37 AM in reply to: rebarwin

Sorry but I find no information in the link you provide

Contributor
rebarwin
Posts: 13
Registered: ‎05-31-2010
Message 4 of 9 (369 Views)

Re: How to choose position of getstring edit box

10-07-2010 03:01 PM in reply to: rebarwin

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

 

Thanks

Jose Maria

Valued Mentor
Jeffrey_H
Posts: 372
Registered: ‎01-20-2010
Message 5 of 9 (355 Views)

Re: How to choose position of getstring edit box

10-07-2010 08:41 PM in reply to: rebarwin

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?

 

You can also find your answers @ TheSwamp
Valued Mentor
KerryBrown
Posts: 271
Registered: ‎11-29-2008
Message 6 of 9 (350 Views)

Re: How to choose position of getstring edit box

10-07-2010 10:06 PM in reply to: rebarwin

 

Do you mean the input box  when dynamic input is active

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

//-------------------------------------------------------

class keyThumper<T> : Lazy<T>;      another  Swamper

Contributor
rebarwin
Posts: 13
Registered: ‎05-31-2010
Message 7 of 9 (342 Views)

Re: How to choose position of getstring edit box

10-07-2010 11:34 PM in reply to: KerryBrown

>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

 

 

Valued Mentor
KerryBrown
Posts: 271
Registered: ‎11-29-2008
Message 8 of 9 (339 Views)

Re: How to choose position of getstring edit box

10-08-2010 12:37 AM in reply to: rebarwin

 

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.

 

 

//-------------------------------------------------------

class keyThumper<T> : Lazy<T>;      another  Swamper

Contributor
rebarwin
Posts: 13
Registered: ‎05-31-2010
Message 9 of 9 (328 Views)

Re: How to choose position of getstring edit box

10-08-2010 07:36 AM in reply to: KerryBrown

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

 

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

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