-
-
Notifications
You must be signed in to change notification settings - Fork 10.5k
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
Hiding the spacing between tabs #4368
Comments
That separation is controlled by The layout of tabs in a tab bar happens during static bool BeginTabItem_NoSeparation(const char* label, bool* p_open = NULL, ImGuiTabItemFlags flags = 0)
{
ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0));
bool result = ImGui::BeginTabItem(label, p_open, flags);
ImGui::PopStyleVar();
return result;
} (You can also call The layout for the docked windows tab bar is done during ImGui::PushStyleVar(ImGuiStyleVar_ItemInnerSpacing, ImVec2(0, 0));
ImGui::NewFrame();
ImGui::PopStyleVar(); (This may have unintended consequences. I didn't notice anything unusual, but quite a lot happens during |
Thanks for your reply @PathogenDavid - I was able to remove the separation between the tabs. However, because of the patch submitted for #4130, the dropdown in the corner is now akwardly pressed up against the first tab. This is because |
Ah yeah, hadn't notice that. That's pretty claustrophobic, the X button is pretty squished too. Unfortunately that does mean there probably isn't a great way to get what you want for the docked window tab bars. My understanding is that styling v2 will allow more granular per-widget customization like this, but as far as I'm aware that's still a long-term project. If you really want this today, your best bet is probably to fork Dear ImGui for yourself and remove the spacing directly to avoid the unintended side-effects. (Or convince Omar to add a Line 7453 in 7bfc379
|
I see. I can propose a This way, we can provide more fine-grained control over tab spacing, while still respecting #4130 if the user still wants that behavior (set Then, in the setup code: ImGuiStyle& style = ImGui::GetStyle();
style.TabInnerSpacing.x = 0.0f; // No spacing between tabs, but keep the default for everything else @PathogenDavid @ocornut If this all sounds fine I'll submit a PR for the mainstream and docking branches. |
@AidanSun05 Can you a share a code example? |
The docked windows are created in |
Version/Branch of Dear ImGui:
Version: 1.84 WIP
Branch: docking
Back-end/Renderer/Compiler/OS
(irrelevant)
My Issue/Question:
Is there a way to set the spacing between tabs [both docked and in
BeginTabBar()
] to 0 without affecting anything else?I want to hide the gaps shown by the arrows in the image above.
Standalone, minimal, complete and verifiable example:
The text was updated successfully, but these errors were encountered: