Closed xahon closed 6 months ago
You should pass a size to DockSpace()
to correctly leave room for a tab bar, otherwise by default DockSpace()
will use all remaining space.
Probably the right size to use is ImVec2(0.0f, -ImGui::GetFrameHeightWithSpacing())`.
You should pass a size to
DockSpace()
to correctly leave room for a tab bar, otherwise by defaultDockSpace()
will use all remaining space. Probably the right size to use is ImVec2(0.0f, -ImGui::GetFrameHeightWithSpacing())`.
It fixes the problem with unwanted scrollbars. Now I can see tabs at the bottom of the screen without scrolling
If you want the tab bar to be above the DockSpace() then submit the tab-bar before the DockSpace().
When I submit tabbar along with all sub windows before I define dockspace and its settings, it breaks. Tabs are shown in expected position but windows are floating and not docked to anything
Oh, I got your point. I can read BeginTabBar
into a bool variable, then define dockspace and only then define actual windows
I cannot understand your question without actual code. Dockspace needs to be submitted before any window that may be docked into it. see Examples->Documents for an example.
Yeah, thanks, I've figured out how to make tab bar right way
I used this approach in Imgui
// MenuBar
// Dockspace
if (BeginTabBar()) {
// Draw windows
}
But instead I needed to use this one
// MenuBar
bool tabBarStarted = BeginTabBar();
// Dockspace
if (tabBarStarted) {
// Draw windows
}
I think the right pattern you may be looking for is:
if (BeginTabBar(....)
{
DockSpace(...);
DrawWindows();
EndTabBar();
}
else
{
DockSpace(..., ImGuiDockNodeFlags_KeepAliveOnly);
}
Keeping the dockspace alive ensure windows don't get undocked if other windows than DrawWindows() are docked into this DockSpace(). Otherwise if a DockSpace() stops being alive, all its windows will get undocked.
Version/Branch of Dear ImGui:
Version b39fc84f, Branch: docking
Back-ends:
imgui_impl_opengl3.cpp + imgui_impl_glfw.cpp
Compiler, OS:
msvc 2022
Full config/build information:
Details:
My Issue/Question:
I'm trying to make a log viewer which contains menu bar, multiple tabs with views that utilize docking feature. Code boils down to this
This code breaks, tabs are shown below the subviews creating an unwanted scrollbar on the edge of subviews rect. Tabs are functional, docking layout is preserved between tabs (as I want to be) but the placement of the tabs is not applicable for me.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response