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

Stretch table to window scrollable size #7574

Open
akbyrd opened this issue May 11, 2024 · 0 comments
Open

Stretch table to window scrollable size #7574

akbyrd opened this issue May 11, 2024 · 0 comments

Comments

@akbyrd
Copy link

akbyrd commented May 11, 2024

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();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants