Message 1 of 15
How to handle multiple open documents gracefully
Not applicable
10-02-2007
08:20 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have a .NET app that is loaded with the NETLOAD command. I have a single command method that loads a custom control into a palette, and displays it. Whenever my code needs a reference to "ThisDrawing", "ThisAcad", "ThisDB" etc... it is gotten from a function that returns the needed reference. That said I have a few questions:
Why do my event handlers (the app in general) only become active after I type the command for my command method? Why are they not functional after the NETLOAD command? Is my application object (the class that contains my command method and my withevents member declarations) only instantiated when a command method is called?
Why does my app stop working when a new drawing is opened if the AcadApp, Document, Editor, Database etc.. references are gotten from a function? Example:
Dim WithEvents ThisDrawing as Document = GetDoc()
I think I am incorrectly assuming that each time my code uses ThisDrawing, it's the same as calling GetDoc(). Maybe I should explicitly set ThisDrawing = GetDoc() each time a new drawing becomes active?
Any other tips on gracefully handling the transition from active document to active document will be much appreciated as well.
TIA
Why do my event handlers (the app in general) only become active after I type the command for my command method? Why are they not functional after the NETLOAD command? Is my application object (the class that contains my command method and my withevents member declarations) only instantiated when a command method is called?
Why does my app stop working when a new drawing is opened if the AcadApp, Document, Editor, Database etc.. references are gotten from a function? Example:
Dim WithEvents ThisDrawing as Document = GetDoc()
I think I am incorrectly assuming that each time my code uses ThisDrawing, it's the same as calling GetDoc(). Maybe I should explicitly set ThisDrawing = GetDoc() each time a new drawing becomes active?
Any other tips on gracefully handling the transition from active document to active document will be much appreciated as well.
TIA