Kean Walmsley


  • About the Author
    Kean on Google+

April 2014

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30      







« Using the P/Invoke Interop Assistant to help call ObjectARX from .NET | Main | Catching exceptions thrown from dialogs inside AutoCAD using .NET »

August 07, 2008

The right way to show modal and modeless dialogs in AutoCAD using .NET

My manager is currently sailing back from Honolulu to San Francisco, after his boat came 2nd in its division in the 2008 Pacific Cup (congratulations, Jim! :-), so I'm spending more time on management-related activities than I would normally. Which means I'm getting less time to spend on the fun stuff, such as researching blog posts: I'm plundering what I can from my email archives, but my output may feel a little thin over the next week or two.

Here's some information from an internal discussion that I thought might be of general interest.

The question:

Why is it important to use Application.ShowModalDialog() or Application.ShowModelessDialog()? The documentation for both these commands says "You must use this method instead of Form.Show[Dialog], which may lead to unexpected behavior." Any pointers as to what the "unexpected behavior" might be?

Here's the answer, provided by a member of the AutoCAD Engineering team:

There are a number of reasons to use Application.Show[Modal/Modeless]Dialog() rather than Form.Show[Dialog]:

    1. Dialogs will automatically pick up the icon of the host product
    2. Dialog size and position will be persisted automatically
    3. Other floating AutoCAD windows (e.g. the Properties palette) will be disabled, as needed
    4. The DIASTAT system variable will be set properly with the exit status of the dialog

TrackBack

TrackBack URL for this entry:
http://www.typepad.com/services/trackback/6a00d83452464869e200e553f004198834

Listed below are links to weblogs that reference The right way to show modal and modeless dialogs in AutoCAD using .NET:

blog comments powered by Disqus

10 Random Posts