diff --git a/imgui.cpp b/imgui.cpp index 404b91ce..93f229c3 100644 --- a/imgui.cpp +++ b/imgui.cpp @@ -13507,8 +13507,9 @@ void ImGui::BeginDocked(ImGuiWindow* window, bool* p_open) else window->Flags &= ~ImGuiWindowFlags_NoTitleBar; // Clear the NoTitleBar flag in case the user set it: confusingly enough we need a title bar height so we are correctly offset, but it won't be displayed! - // Save new dock order only if the tab bar is active - if (node->TabBar) + // Save new dock order only if the tab bar has been visible once. + // This allows multiple windows to be created in the same frame and have their respective dock orders preserved. + if (node->TabBar && node->TabBar->CurrFrameVisible != -1) window->DockOrder = (short)DockNodeGetTabOrder(window); if ((node->WantCloseAll || node->WantCloseTabID == window->ID) && p_open != NULL)