Skip to content
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

NoCollapse and NoTitleBar in docking #6282

Closed
thewoz opened this issue Mar 30, 2023 · 5 comments
Closed

NoCollapse and NoTitleBar in docking #6282

thewoz opened this issue Mar 30, 2023 · 5 comments
Labels

Comments

@thewoz
Copy link

thewoz commented Mar 30, 2023

Branch: docking

Sorry for the stupid question but I couldn't find the solution.
I'm trying not to render the elements circled in red and I can't do it.

Screenshot 2023-03-30 at 11 55 36

I tried to do it this way but it doesn't work

`ImGui::Begin("MainWindow", NULL, ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoTitleBar);

ImGui::Begin("Left", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
ImGui::Begin("Right", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
ImGui::Begin("Down", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar);
`

@GamingMinds-DanielC
Copy link
Contributor

It's not the window, but the dock space that you need to configure properly. Search for ImGuiDockNodeFlags_AutoHideTabBar in the demo sources.

@ocornut
Copy link
Owner

ocornut commented Mar 30, 2023

This and similar questions have been discussed in #5597 #4880 #3521 #3335

Essentially, the problem is that as multiple windows can be hosted by a docking-node, it isn't a correct default behavior that window apply their settings to parent node, as it would conflict if multiple windows were in that same node.

You can use this:

ImGuiWindowClass window_class;
window_class.DockNodeFlagsOverrideSet = ImGuiDockNodeFlags_NoTabBar;

ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Left", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); ImGui::End();

ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Right", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); ImGui::End();

ImGui::SetNextWindowClass(&window_class);
ImGui::Begin("Down", NULL, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar); ImGui::End();

However if you dock both of those windows together you won't see the tab bar...

Maybe a better solution for you is to use ImGuiDockNodeFlags_AutoHideTabBar instead of ImGuiDockNodeFlags_NoTabBar.

@thewoz
Copy link
Author

thewoz commented Mar 30, 2023

Amazing it works perfectly!

@thewoz thewoz closed this as completed Mar 30, 2023
@UFifty50
Copy link

How can I do the exact opposite of this?
i.e. ImGuiDockNodeFlags_NoTabBar prevents a window's tab bar from ever existing, how can I prevent the window's tab bar from being collapsed and make sure its always open?

@UFifty50
Copy link

UFifty50 commented Jan 16, 2024

How can I do the exact opposite of this? i.e. ImGuiDockNodeFlags_NoTabBar prevents a window's tab bar from ever existing, how can I prevent the window's tab bar from being collapsed and make sure its always open?

I've worked it out after reading through the DockNodeUpdateTabBar source.
If anyone else has this issue, here's how I fixed it:

ImGuiWindowClass winClass;
winClass.DockNodeFlagsOverrideSet = ImGuiDockNodeFlags_NoWindowMenuButton;

ImGui::SetNextWindowClass(&winClass);
ImGui::Begin("window");
...

pretty much the same as above, but using ImGuiDockNodeFlags_NoWindowMenuButton.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants