Modeless dialog/Insertion point

Modeless dialog/Insertion point

Anonymous
Not applicable
1,345 Views
11 Replies
Message 1 of 12

Modeless dialog/Insertion point

Anonymous
Not applicable

I have modeless dialog. On dialog I have button on which user clicks, when he wants to pick insertion point. Problem is when I exit dialog the command line is still in command GetPoint (doesn't show usual Command:). How can I solve this problem? My code at the moment is:

 

           // this.Visible = false;

            AppServ.Document adoc = AppServ.Application.DocumentManager.MdiActiveDocument;
           AppServ.DocumentLock dl = adoc.LockDocument();

            Editor ed = adoc.Editor;
            using (ed.StartUserInteraction(this))
            {
                PromptPointOptions ppo = new PromptPointOptions("Pick Point:");
                PromptPointResult respt = ed.GetPoint(ppo);
                if (respt.Status == PromptStatus.OK)
                {

                       //Do something
                }
                dwg.Dispose();
            }

            dl.Dispose();
           // this.Visible = !this.Visible;

0 Likes
1,346 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable

Hi carl,

 

Kan you tell me how you invoke your command to display the modeless form?

 

Are you using a commandmethod or are you invoking a method directly from your class???

When your invoking a method thats the problem. All commands need to be invoked trough a commandmethod attribbute.

 

Otherwise you will get this strange behavior of the command line.

 

kind regards,

 

irvin

0 Likes
Message 3 of 12

Anonymous
Not applicable

Somehow like this:

 

    public void dialog()
    {     

       Dlg dlg = new Dlg();

       dlg.Show(new WindowWrapper(AcadApp.MainWindow.Handle));

    }

 

    [CommandMethod("Test")]
    static public void Test()
    {
         dialog();
    }

 

0 Likes
Message 4 of 12

Anonymous
Not applicable

can you post an image of the command line?

0 Likes
Message 5 of 12

Anonymous
Not applicable

 

It looks like this when I close dialog (this.Close()).

0 Likes
Message 6 of 12

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

if I understand you right then invoking acedPostCommandPrompt will help, look >>>this<<<

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 7 of 12

Anonymous
Not applicable

this.close is called by a button?

0 Likes
Message 8 of 12

Anonymous
Not applicable

Yes, by button on the modeless form.

0 Likes
Message 9 of 12

Anonymous
Not applicable

Looking at the code you use when startting user interaction please look at this.

 

//Editor ed = AcadAppServ.Application.DocumentManager.MdiActiveDocument.Editor;
            using (AcadAppServ.DocumentLock docLock = AcadAppServ.Application.DocumentManager.MdiActiveDocument.LockDocument())
                using( EditorUserInteraction edUsrInt = ed.StartUserInteraction(this))
                {
                  
                    PromptPointOptions prPtOpts = new PromptPointOptions("\nPlease select a point to place the ellipse:");
                    PromptPointResult prPtRes = ed.GetPoint(prPtOpts);

                    Utilities.AddEllipse(prPtRes.Value);

                    prPtOpts.Message = "\nPlease select a point to place the circle:";
                    prPtRes = ed.GetPoint(prPtOpts);

                    Utilities.AddCircle(prPtRes.Value);
                    edUsrInt.End();
                }

 

I think the problem is caused nod ending the userinteraction edUsrInt.End()

 

 

 

0 Likes
Message 10 of 12

Anonymous
Not applicable

Irvin and Alfred, thanks for replies. At the moment I tried Alfreds suggestion and it works. Imported ObjectARX/LISP command "acedPostCommandPrompt()" does the trick. I will also try Irvins last suggestion if it works. Thanks again.

0 Likes
Message 11 of 12

Anonymous
Not applicable

BTW, you have equivalent function in .NET

 

Autodesk.AutoCAD.Internal.Utils.PostCommandPrompt();

Message 12 of 12

Anonymous
Not applicable

Even better. I will try it. Thanks!

0 Likes