Call to activeDocumentChanged is incorrect

Using MDI create two documents with names, a and b.
Click on each document and at activeDocumentChanged, getTheActive document and look at its name, it is the other documents name. At sometime later in the message loop it corrects itself.

The solution is to comment out the following in
void MultiDocumentPanel::updateOrder()

// if (components != oldList)

Also MultiDocumentPanel::updateOrder should not rearrange the order of documents based on screen location. The order should remain the same as they are created. This is traditional Multiple Document Interface. You can test this with the DemoRunner.

and getActiveDocument should be

Component* MultiDocumentPanel::getActiveDocument() const noexcept
if (mode == FloatingWindows)
for (auto* child : getChildren())
if (auto* dw = dynamic_cast<MultiDocumentPanelWindow*> (child))
if (dw->isActiveWindow())
return dw->getContentComponent();
else if (tabComponent != nullptr)
return tabComponent->getTabContentComponent(tabComponent->getCurrentTabIndex());

return components.getLast();


Thank you for reporting this, a fix is in the works.

As far as I can see MultiDocumentPanel only rearranges the contents of a private components variable, so as long as getActiveDocument() reports the correct value inside activeDocumentChanged(), the ordering shouldn’t cause a problem on its own.

The order should be maintained, just like all multi document apps. Think of a recent document menu list. with short cut keys.
BTW, there are more bugs in this class and when I am sure of the fixes I’ll report it.

A change is out on develop fixing the reported issues