- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am occasionally developing with ObjectARX 2013. The last week I stumbled on a problem that does not seem to have many (elegant) solutions. I thought I should try to engage the community in having it discussed. Thanks in advance for having a look.
The problem: A command being executed from a document needs to focus on another document. I am doing that as:
Application.DocumentManager.MdiActiveDocument = aGeneratedDrawing;
After this line, the focus is taken by the other document. But the command execution just stops without producing any visible error or catchable exception. Apparently, the document focus cannot be changed during execution of a command.
A solution: What worked in the end was displaying a .NET form inside the command, like:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog(aForm);
Then, performing the very same set of actions on a button click works flawlessly.
The question is: can using the form as a mediator be avoided? It is redundant there. I tried hooking to CommandEnded, executing the code as a separate command via Application.DocumentManager.MdiActiveDocument.SendStringToExecute, and also executing the code in a separate delayed thread. So far, only triggering the code via the form worked.
Solved! Go to Solution.