.NET

Reply
Active Member
Stephan.Guympert
Posts: 7
Registered: ‎10-15-2013
Message 1 of 3 (357 Views)

Application.ShowModalDialog vs Application.ShowModelessDialog

357 Views, 2 Replies
10-15-2013 12:55 AM

Hi Guys,

 

I have a strange situation.

 

I am using Application.ShowModelessDislog to bring up a .NET DLL app inside AutoCAD.

 

In principal:

 

I get Data from a SQL source which wfills combo boxs

Then I press a button

and the Dislog Code Compares the Objects in my model (using a 3rd Party API)

Hides all parts that a correct and leaves behind incorrect.

 

If I use Application.ShowModalDialog everything works fine

but

If I use Application.ShowModelessDialog I get error during the processing.

 

Error:  .... has a command in progress. Hit enter to cancel or retry.

 

Any idea what is going on

 

Stephan

 

*Expert Elite*
norman.yuan
Posts: 998
Registered: ‎04-27-2009
Message 2 of 3 (334 Views)

Re: Application.ShowModalDialog vs Application.ShowModelessDialog

10-15-2013 06:38 AM in reply to: Stephan.Guympert

In general, modal dialog box is used in the context of a single document (MdiActiveDocument, usually), while modelesss dialog box is used in the application context and one needs to be handle the events when current document is chnaged (thus the document specific information shown in the modeless form also has to be changed, or the form has to be closed, in order to not confuse the users).

 

From your very brief description, it sounds like you need to lock the document if the coded action in the button-click handler needs to access the drawing database. Spmethign like:

 

private void MyButton_Click(...)

{

    Document dwg=......MdiActiveDocument;

    using (DocumentLock lck=dwg.LockDocument())

    {

       DoTheWorkToDocument(dwg);

    }

}

Active Member
Stephan.Guympert
Posts: 7
Registered: ‎10-15-2013
Message 3 of 3 (286 Views)

Re: Application.ShowModalDialog vs Application.ShowModelessDialog

10-20-2013 07:22 PM in reply to: norman.yuan

I will attempt to try this again but previsouly when I tried this, it made no difference.

 

I appricate the reply.

 

Stephan

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

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