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

Closed
opened 2023-06-10 20:49:10 +00:00 by S0nix12 · 1 comment
S0nix12 commented 2023-06-10 20:49:10 +00:00 (Migrated from github.com)

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

**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](https://github.com/ocornut/imgui/assets/11904109/8db0d7d6-42fd-4eb1-ba54-a57d10461900) This is what it looks without the tabs: ![grafik](https://github.com/ocornut/imgui/assets/11904109/071310be-2aef-4e16-ba08-dcdcd1954096)
ocornut commented 2023-09-11 18:42:44 +00:00 (Migrated from github.com)

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

Thanks for reporting.

Hello, I have fixed this with 3aceb61 + bed492d And added regression tests in https://github.com/ocornut/imgui_test_engine/commit/8855e8cfe662a8c2c23f5bc22bbc172e5f40c542 Thanks for reporting.
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
ocornut/imgui#6510
No description provided.