Open AMRD1234 opened 2 months ago
There are no collapse buttons in docked windows, not even if you don't disable them. This is a different button that looks different and serves a different function. It belongs to the dock node itself, not to the docked window(s). That's also why there is only one if you dock multiple windows into the same node.
Thank you for your answer. So is there a way to remove this button from the dock node? how to initialize that in ImGuiDockNodeFlags to do not create this button? This is my dock code (copied from demo.cpp): void Create_DockSpace() { static bool opt_fullscreen = true; static bool opt_padding = false; static ImGuiDockNodeFlags dockspace_flags = ImGuiDockNodeFlags_None;
// We are using the ImGuiWindowFlags_NoDocking flag to make the parent window not dockable into,
// because it would be confusing to have two docking targets within each others.
ImGuiWindowFlags window_flags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking;
if (opt_fullscreen)
{
const ImGuiViewport* viewport = ImGui::GetMainViewport();
ImGui::SetNextWindowPos(viewport->WorkPos);
ImGui::SetNextWindowSize(viewport->WorkSize);
ImGui::SetNextWindowViewport(viewport->ID);
ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
window_flags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove;
window_flags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus;
}
else
{
dockspace_flags &= ~ImGuiDockNodeFlags_PassthruCentralNode;
}
// When using ImGuiDockNodeFlags_PassthruCentralNode, DockSpace() will render our background
// and handle the pass-thru hole, so we ask Begin() to not render a background.
if (dockspace_flags & ImGuiDockNodeFlags_PassthruCentralNode)
window_flags |= ImGuiWindowFlags_NoBackground;
// Important: note that we proceed even if Begin() returns false (aka window is collapsed).
// This is because we want to keep our DockSpace() active. If a DockSpace() is inactive,
// all active windows docked into it will lose their parent and become undocked.
// We cannot preserve the docking relationship between an active window and an inactive docking, otherwise
// any change of dockspace/settings would lead to windows being stuck in limbo and never being visible.
if (!opt_padding)
ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
ImGui::Begin("DockSpace", NULL, window_flags);
if (!opt_padding)
ImGui::PopStyleVar();
if (opt_fullscreen)
ImGui::PopStyleVar(2);
// Submit the DockSpace
ImGuiIO& io = ImGui::GetIO();
if (io.ConfigFlags & ImGuiConfigFlags_DockingEnable)
{
ImGuiID dockspace_id = ImGui::GetID("Editor DockSpace");
ImGui::DockSpace(dockspace_id, ImVec2(0.0f, 0.0f), dockspace_flags);
}
ImGui::End(); }
Thank you for your answer. So is there a way to remove this button from the dock node? how to initialize that in ImGuiDockNodeFlags?
I never tried this specific one myself, but there should be multiple ways. First you need to include imgui_internal.h
to have access to the required flag. Along with that comes the warning that this is not a guaranteed stable API, so use at your own risk. Code based on internals can potentially break with future updates, but if you manage your code well (f.e. wrapping access to internals into a small custom extension library) this shouldn't be a problem.
For the entire dock space:
DockSpace()
or DockSpaceOverViewport()
, include ImGuiDockNodeFlags_NoWindowMenuButton
in the flagsBuilding the dock nodes manually:
DockBuilder...
functionsDockBuilderAddNode()
, include ImGuiDockNodeFlags_NoWindowMenuButton
in its flagsManipulating the flags of an existing node:
node->SetLocalFlags(node->LocalFlags | ImGuiDockNodeFlags_NoWindowMenuButton);
By way of the window(s) docked into the node:
SetNextWindowClass()
to configure the window you are docking into that nodeImGuiWindowClass::DockNodeFlagsOverrideSet
include ImGuiDockNodeFlags_NoWindowMenuButton
By way of the window(s) docked into the node: use SetNextWindowClass() to configure the window you are docking into that node have ImGuiWindowClass::DockNodeFlagsOverrideSet include ImGuiDockNodeFlags_NoWindowMenuButton
This is the best and simplest way.
As always the recurrent problem with docking questions is that people want to manipulate a dock node property which is shared by multiple windows, by definition there is a potential conflict, what is 2 windows which have opposite requests are docked together?
I think I understood it. Thank you, but apparently my question upset you 'ocornut'... Sorry, I'm new to IMGUI and confused, but I'm interested in this API... Maybe my question was ridiculous Anyway, thanks for your reply
Sorry I didn't meant to suggest i was upset, but because we answer lots of question I'm not always overly enthusiastic.
Your question is not ridiculous. But there isn't a simple solution that works for all situations, and I guess it is frustrating that we don't have a good answer for it yet.
No problem. I understand that it is difficult for you to answer all the questions and there is no room for despair. I think IMGUI is the best API for UI and I'm eager to learn it and this little problem can't stop me. We look forward to further development of IMGUI and your success.
Hi .. it fixes by seting Window menu Button position to none.
Thats so cool.
thank you...!
Version/Branch of Dear ImGui:
Version 1.90.5 (19050) Branch docking
Back-ends:
imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler, OS:
Windows 10
Full config/build information:
Details:
My Issue/Question:
greetings. I don't need the collapse button and "Hide tab bar" button for some windows when they are in dock mode,. In dock mode, I cant destroy "Hide tab bar" button. Out Of Docking :
In Dock:
This is my code :
![28](https://github.com/ocornut/imgui/assets/113169019/023cad43-c5f9-4626-8a3c-8c6dac0ed809)
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code: