-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows undocks when DockSpace() is not submitted (e.g. host collapsed) #2599
Comments
As you the code shows you have stopped submitting the dockspace, if you stop submitting the dockspace it doesn't exist any more. If we were to have those docked window hold into non-active dockspaces, it becomes impossible to decide at which point they should let go of it. It means that if you made any change to your code (e.g. moved/renamed a dockspace), those windows would stay hidden forever. So the decision that comes naturally from that and which fits with every other decision in the ecosystem, is that windows undock themselves if their parent dockspace is not active. The demo help marker says:
What would you suggest? |
After @ocornut comment from the #2109 thread, I changed the code to always do the dockspace even though ::Begin returns false (collapsed) but the window is active and that fixed it. All docked windows are now properly hiding when my master window gets collapsed. I'll leave this code here as a reference for others who might want to try this.
Thanks for your awesome work! |
It definitely makes lots of sense. The biggest issue I had with this feature is that I always assumed that if a ::Begin call was returning false, I couldn't assume that CurrentWindow was set. My bad. That and you were just too fast on this one and posted before I could submit my own solution to this! :) On a side note, I did try to play with ImGuiDockNodeFlags_KeepAliveOnly but couldn't see the gain so I will investigate that one later. |
I've been going through open Docking issues:
I am surprised my first answer didn't mention It also ties with this:
I'm trying to steer dear imgui toward "fixing" the inconsistent Begin/End API and that change would change the assumption above. Among the problems this Begin/End API change would lead to, the submission of dockspace in a collapsed window would be problematic. I haven't decided between having a Begin()-end flags to ensure "always get in the window" (which will be required for very few edge cases, including this one) or having an equivalent of the _KeepAlive that which can be "actioned" from outside the window. Aside from one minor remaining change, calling |
@ocornut I'm having some issues with the soultion @BeachCoder76 suggested when I use it together with a modal popup When I open a popup when the Master Window gets closed it brings the Master Window in focus above the modal popup. The window cant be moved though and the popup cant be accesed through it. For this to occur the Master Window has to be docked to another window as a tab and be a not selected tab like so: When I then close the Master Window it appears before the popup like so: Version 1.84 WIP code: ImGui::Begin("Window");
ImGui::End();
static ImGuiID dockspaceID = 0;
static bool winOpenWish = true;
if (ImGui::Begin("Master Window", &winOpenWish))
{
ImGui::TextUnformatted("DockSpace below");
}
// Declare Central dockspace
dockspaceID = ImGui::GetID("HUB_DockSpace");
ImGui::DockSpace(dockspaceID , ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None|ImGuiDockNodeFlags_PassthruCentralNode/*|ImGuiDockNodeFlags_NoResize*/);
ImGui::End();
if (!winOpenWish)
{
ImGui::OpenPopup("Popup");
}
//ImGui::SetNextWindowFocus();
if (ImGui::BeginPopupModal("Popup"))
{
ImGui::TextUnformatted("a popup");
ImGui::EndPopup();
}
ImGui::SetNextWindowDockID(dockspaceID , ImGuiCond_FirstUseEver);
if (ImGui::Begin("Dockable Window"))
{
ImGui::TextUnformatted("Test");
}
ImGui::End(); |
Version/Branch of Dear ImGui:
Version: v1.70 WIP
Branch: Docking branch
Back-end/Renderer/Compiler/OS
Back-ends: custom
Compiler: Dev Studio 2019
Operating System: Win10
My Issue/Question:
What I want to achieve creating a master window which has a Dockspace built into it. Then, automatically docking other windows at creation time into that DockSpace. Then, the user can decide to undock or dock back anywhere in the viewport.
Issue I'm having is that upon collapsing the master window, all docked windows undock automatically.
I would have assumed that all windows would disappear since the top window is collapsed.
Screenshots/Video
Standalone, minimal, complete and verifiable example:
#2109
The text was updated successfully, but these errors were encountered: