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

Scrollable Table in Tab does not properly contribute to initial window size #6510

Closed
S0nix12 opened this issue Jun 10, 2023 · 1 comment
Closed
Labels
tabs tab bars, tabs window sizing

Comments

@S0nix12
Copy link

S0nix12 commented Jun 10, 2023

Version/Branch of Dear ImGui:

Version: 1.89.6
Branch: master

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_win32.cpp + imgui_impl_dx11.cpp

My Issue/Question:
Hello, I am currently trying to add a table to a tab inside a small window. The window does only include tabs with these tables. I also use the ScrollY flag on the table as I would like to freeze the HeadersRow.
The problem is that when the window is opened it does no automatically size correctly and is displayed very small.
When I put the table directly in the window without tabs it does auto size correctly on opening the window.
It also works without the ScrollY flag. I tried giving an outer_size with a non zero x value to the BeginTable function but that means the table is not filling the full horizontal space of the window when it is resized which is not ideal.
I could give a window a reasonable initial size but I was wondering if the not working auto size was a bug as it works without the tabs.

Here is a small example of the problem (I added NoSavedSettings to make sure it always behaves like the first opening after restart):

if(ImGui::Begin("Test Window", nullptr, ImGuiWindowFlags_NoSavedSettings))
{
	if(ImGui::BeginTabBar("Tabs"))
	{
		if (ImGui::BeginTabItem("Tab1"))
		{
			if (ImGui::BeginTable("Table1", 4, ImGuiTableFlags_ScrollY | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Resizable))
			{
				ImGui::TableSetupScrollFreeze(0, 1);
				ImGui::TableSetupColumn("Column1");
				ImGui::TableSetupColumn("Column2");
				ImGui::TableSetupColumn("Column3");
				ImGui::TableSetupColumn("Column4");
				ImGui::TableHeadersRow();

				for (int i = 0; i < 20; ++i)
				{
					ImGui::TableNextColumn();
					ImGui::Text("Test Entry %i", i);
				}
				ImGui::EndTable();
			}
			ImGui::EndTabItem();
		}
		ImGui::EndTabBar();
	}
}
ImGui::End();

This is what it looks for me:
grafik
This is what it looks without the tabs:
grafik

@ocornut ocornut added tabs tab bars, tabs window sizing labels Sep 11, 2023
ocornut added a commit that referenced this issue Sep 11, 2023
ocornut added a commit to ocornut/imgui_test_engine that referenced this issue Sep 11, 2023
@ocornut
Copy link
Owner

ocornut commented Sep 11, 2023

Hello,
I have fixed this with 3aceb61 + bed492d
And added regression tests in ocornut/imgui_test_engine@8855e8c

Thanks for reporting.

@ocornut ocornut closed this as completed Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tabs tab bars, tabs window sizing
Projects
None yet
Development

No branches or pull requests

2 participants