-
-
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
BeginChild Resize to Contents? #1666
Comments
Hello @skl131313, unfortunately it isn't possible at the moment. I see what you are trying to do and agree it would be helpful. I have an idea of how to implement it but it's not a trivial change and I don't know when I'll be able to tackle it. In the meanwhile, maybe using both flags |
No worries if it requires a big change, it's more of a nice to have feature than a requirement. |
…ResizeY, ImGuiChildFlags_AlwaysAutoResize + support for SetNextWindowSizeConstraints(). (#1666, #1395, #1496, #1710) + Demo Note that child don't report ideal content size to parent so nesting may be difficult. Note 4e4042b simplified SkipItems logic. Note e2035a5 standardizing WindowMinSize application on child
It is now possible to
See #1710 and new examples in "Demo->Layout->Child Windows" Basic auto-resize: ImGui::BeginChild("name", ImVec2(-FLT_MIN, 0.0f), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY); Using a min/max constraint may be particularly useful: ImGui::SeparatorText("Auto-resize with constraints");
static int draw_lines = 3;
static int max_height_in_lines = 10;
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
ImGui::DragInt("Lines Count", &draw_lines, 0.2f);
ImGui::SetNextItemWidth(ImGui::GetFontSize() * 8);
ImGui::DragInt("Max Height (in Lines)", &max_height_in_lines, 0.2f);
ImGui::SetNextWindowSizeConstraints(ImVec2(0.0f, ImGui::GetTextLineHeightWithSpacing() * 1), ImVec2(FLT_MAX, ImGui::GetTextLineHeightWithSpacing() * max_height_in_lines));
if (ImGui::BeginChild("ConstrainedChild", ImVec2(-FLT_MIN, 0.0f), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY))
for (int n = 0; n < draw_lines; n++)
ImGui::Text("Line %04d", n);
ImGui::EndChild(); If you omit the Please note that combining both |
Is there a resize to content mode for an axis using
ImGui::BeginChild()
?I want to have horizontal scrolling but I don't want there to be vertical scrolling. I want it to resize to the size of the contents vertically. Is there anything like this?
I can manually set a fixed size, but then I need to calculate and compensate for when the horizontal scrollbar might be visible.
The text was updated successfully, but these errors were encountered: