TheSwamp

Code Red => .NET => Topic started by: GUIDO ROOMS on August 13, 2012, 07:21:07 AM

Title: eDocumentSwitchDisabled
Post by: GUIDO ROOMS on August 13, 2012, 07:21:07 AM
Just found out that if I try to switch the active document from a modal dialog I get this error.
CommandFlags.Session is no help.
Locking documents is no help.
The dialog has to be modeless, in this case everything works.
Well, let's hope I'm right.

Loving Autodesk more and more each day.
To the blockheads who've written those docs: things like that should be *prominent* in the documentation
and should not be left to be inferred by trial and error.
Title: Re: eDocumentSwitchDisabled
Post by: Alexander Rivilis on August 13, 2012, 07:40:55 AM
Maybe this code help you:
Code: [Select]
Application.DocumentManager.DocumentActivationEnabled = true;
Title: Re: eDocumentSwitchDisabled
Post by: GUIDO ROOMS on August 13, 2012, 08:32:33 AM
Thanks a lot Alexander.
This works.
Saves my day.
Title: Re: eDocumentSwitchDisabled
Post by: GUIDO ROOMS on August 13, 2012, 11:29:56 AM
Maybe an interesting remark:
Since in the dll I'm currently writing, all dialogs will be executed modally,
I tried to be clever and put the  line  Application.DocumentManager.DocumentActivationEnabled = true;
in Initialize(), but that doesn't work.

Thanks again for your reply.
Title: Re: eDocumentSwitchDisabled
Post by: Alexander Rivilis on August 13, 2012, 04:44:28 PM
Maybe an interesting remark:
Since in the dll I'm currently writing, all dialogs will be executed modally,
I tried to be clever and put the  line  Application.DocumentManager.DocumentActivationEnabled = true;
in Initialize(), but that doesn't work.

Thanks again for your reply.

That is because runing modal dialog disable document activation and you have to enable activation just before switching documents.