.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Modeless dialog/Insertion point

11 REPLIES 11
Reply
Message 1 of 12
jernej.carl
783 Views, 11 Replies

Modeless dialog/Insertion point

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;

11 REPLIES 11
Message 2 of 12
Irvin
in reply to: jernej.carl

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

Message 3 of 12
jernej.carl
in reply to: Irvin

Somehow like this:

 

    public void dialog()
    {     

       Dlg dlg = new Dlg();

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

    }

 

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

 

Message 4 of 12
Irvin
in reply to: jernej.carl

can you post an image of the command line?

Message 5 of 12
jernej.carl
in reply to: Irvin

 

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

Message 6 of 12
Alfred.NESWADBA
in reply to: Irvin

Hi,

 

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

 

HTH, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 7 of 12
Irvin
in reply to: jernej.carl

this.close is called by a button?

Message 8 of 12
jernej.carl
in reply to: Irvin

Yes, by button on the modeless form.

Message 9 of 12
Irvin
in reply to: jernej.carl

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()

 

 

 

Message 10 of 12
jernej.carl
in reply to: Irvin

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.

Message 11 of 12
kob4lt
in reply to: jernej.carl

BTW, you have equivalent function in .NET

 

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

Message 12 of 12
jernej.carl
in reply to: kob4lt

Even better. I will try it. Thanks!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost