Hi.
I´m using the events "DocumentActivated" and the event "DocumentDestroyed" .
With the "DocumentDestroyed" method I can know how many documents are closed and when is the last..
But, I want to know, how many documents are minimized (deactivated).
It´s to say, there aren´t any active (current) document.
Trank you.
The DocumentCollection's Count property tells you how many documents exist.
There can be only one active document so the number of 'deactivated' documents is the value of the Count property minus 1.
When the DocumentToBeDestroyed event fires, if the document that's about to be destroyed is the only open document, then at that point, the DocumentCollection's Count property will be 1, and it means that AutoCAD is entering 'zero document state' (where there are no open documents).
ok, but if I have all my documents as a(deactivated) documents. Which is the active document? What´s the name or Id of this?
Because I can have all my documents as a deactivated document.
Thank you for reply.
@joantopo wrote:Because I can have all my documents as a deactivated document.
How do you do that?
@joantopo wrote:but if I have all my documents as a(deactivated) documents. Which is the active document?
If you have them all "deactivated" then how could one active?
I just noticed you mention minimized so when you say "deactivated" you mean minimized?
You can still enter commands and interact with active document when all them all minimized, but I think your looking for
Application.DocumentManager.MdiActiveDocument.Window.WindowState
Yes, all right.
I was confusing deactivated with minimized. I wanted to say "minimized".
I´m going to try this line code.
Thank you.
I don´t understand because Autodesk interpret that the window state = normal is the same that state=minimized..
private void callback_documentActivated(object sender, DocumentCollectionEventArgs e) { if (ComprobarTodosMinimizados()==false) System.Windows.Forms.MessageBox.Show("abiertoooooooo"); else System.Windows.Forms.MessageBox.Show("todos minimizados"); } public bool ComprobarTodosMinimizados() { bool TodosMinimizados = false; int contador = 0; DocumentCollection docs = Application.DocumentManager; foreach (Document doc in docs) { if (doc.Window.WindowState == Autodesk.AutoCAD.Windows.Window.State.Minimized); // si se minimiza la ventana { contador++; } } if (contador == Application.DocumentManager.Count) { TodosMinimizados = true; } return TodosMinimizados; }
is this right?
if (doc.Window.WindowState == Autodesk.AutoCAD.Windows.Window.State.Minimized);
Can't find what you're looking for? Ask the community or share your knowledge.