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

Application.ShowModalDialog vs Application.ShowModelessDialog

2 REPLIES 2
Reply
Message 1 of 3
Stephan.Guympert
1035 Views, 2 Replies

Application.ShowModalDialog vs Application.ShowModelessDialog

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

 

2 REPLIES 2
Message 2 of 3

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

    }

}

Norman Yuan

Drive CAD With Code

EESignature

Message 3 of 3

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

 

I appricate the reply.

 

Stephan

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