GetString multiple document

GetString multiple document

shkangE79NB
Participant Participant
642 Views
2 Replies
Message 1 of 3

GetString multiple document

shkangE79NB
Participant
Participant

Hi. I'm trying to get Integer value for each tab using GetInteger().

However, only the first tab is input and other tabs are treated as *Cancel*. Why?

 

<CommandMethod("BBB", CommandFlags.Session Or CommandFlags.Interruptible Or CommandFlags.Modal)>
    Public Sub MyCommand2()
        For Each Doc As Document In Application.DocumentManager
            Application.DocumentManager.MdiActiveDocument = Doc

            Dim rst As PromptIntegerResult = Doc.Editor.GetInteger("INPUT : ")
            If rst.Status = PromptStatus.OK Then
                Doc.Editor.WriteMessage(rst.Value.ToString)
            Else
                Doc.Editor.WriteMessage("Failed.")
            End If
        Next
        MsgBox("Done.")
    End Sub

 

0 Likes
Accepted solutions (1)
643 Views
2 Replies
Replies (2)
Message 2 of 3

Norman_Yuan
Mentor
Mentor
Accepted solution

AutoCAD 2015 introduced a rather significant change: changing active document would cancel a current command in the drawing document that was active. This change did break a lot of existing custom CAD applications, be they LISP, or VBA, or .NET, or  ObjectARX apps.

 

So, in your code, you cannot ask user to interact with multiple document with GetString(), or in general, all those GetXXXX()/SelectXXXXX() methods.

 

I have 2 articles on this issue that may help you to work around:

 

https://drive-cad-with-code.blogspot.com/2017/04/asking-user-to-select-entity-in-other.html 

https://drive-cad-with-code.blogspot.com/2017/04/asking-user-to-select-entity-in-other_4.html 

 

 

Norman Yuan

Drive CAD With Code

EESignature

0 Likes
Message 3 of 3

shkangE79NB
Participant
Participant

Thanks for pointing out an important issue! 

0 Likes