.NET

.NET

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

Application.ShowModalDialog vs Application.ShowModelessDialog

390 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: 1,064
Registered: ‎04-27-2009
Message 2 of 3 (367 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 (319 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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.