imgui icon indicating copy to clipboard operation
imgui copied to clipboard

Stretch table to window scrollable size

Open akbyrd opened this issue 1 year ago • 1 comments

Version/Branch of Dear ImGui:

1.90.1, docking

Back-ends:

Custom (Unreal)

Compiler, OS:

Windows 11, MSVC 2022

Full config/build information:

No response

Details:

I have a table in a window that has ImGuiWindowFlags_HorizontalScrollbar. If the window is too narrow for its contents and the horizontal scrollbar appears I'd like the table to stretch to the width of the window contents, instead of the physical window itself.

I don't think I can get the content size and specify the table width manually since that forms a feedback loop where the table can never get narrower.

Is this a supported use case?

Screenshots/Video:

image

Minimal, Complete and Verifiable Example code:

if (ImGui::Begin("Window", nullptr, ImGuiWindowFlags_HorizontalScrollbar))
{
	ImGui::Button("Button", ImVec2(400, 20));

	auto Flags = ImGuiTableFlags_RowBg | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersInnerV;
	if (ImGui::BeginTable("Table", 2, Flags))
	{
		ImGui::TableSetupColumn("One");
		ImGui::TableSetupColumn("Two");
		ImGui::TableHeadersRow();

		ImGui::TableNextColumn();
		ImGui::Text("Content");

		ImGui::TableNextColumn();
		ImGui::Text("Content");

		ImGui::EndTable();
	}
}
ImGui::End();

akbyrd avatar May 11 '24 00:05 akbyrd

any update on this?

catlowlevel avatar Sep 27 '24 06:09 catlowlevel