-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Unable to programmatically resize a child #8020
Comments
I should add to this that I want the user to be able to dynamically resize the child (hence ImGuiChildFlags_ResizeY) as well as force it in code. |
Presumably not at the same time? As in, you are not calling SetNextWindowSizs() every frame, but only on certain events? I will investigate this when possible, it is possible that there may be an issue. |
If you force the height every frame, the user won't be able to resize at all, you need to restrict the forced height to those frames where you actually want to set it. Besides that, for user resizable children the user specified size is prioritized and overwrites the size specified by code, so you might need to get a bit creative. One option is to automatically resize with Another option is to (also for one frame) limit the size with |
I can confirm that this currently doesn't work: if (ImGui::Button("Set Height to 500"))
ImGui::SetNextWindowSize(ImVec2(-FLT_MIN, 500.0f));
ImGui::PushStyleColor(ImGuiCol_ChildBg, ImGui::GetStyleColorVec4(ImGuiCol_FrameBg));
if (ImGui::BeginChild("ResizableChild", ImVec2(-FLT_MIN, ImGui::GetTextLineHeightWithSpacing() * 8), ImGuiChildFlags_Borders | ImGuiChildFlags_ResizeY))
for (int n = 0; n < 10; n++)
ImGui::Text("Line %04d", n);
ImGui::PopStyleColor();
ImGui::EndChild(); Aka |
I have pushed a fix 797101a for the case in my previous post. I'm not entirely sure this is what you wanted but it seems useful to allow it. Unfortunately we can't easily support Amended test: Let me know if that solves your problem! |
Version/Branch of Dear ImGui:
Latest master (9644c51)
Back-ends:
imgui_impl_dx12.cpp + imgui_impl_win32.cpp
Compiler, OS:
Windows 11, MSVC 2022
Full config/build information:
1.91.3 WIP (19121)
Details:
My Issue/Question:
I'm trying to resize some children from their initially created size based on some factors and miserably failing. The children resize with the horizontal resize bars, but if I try to force it from code the size doesn't apply. Am I holding it wrong?
In the MCVE I set a certain size on the first frame which is applied to the window and subsequently try to set a different size on later frames.
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
The text was updated successfully, but these errors were encountered: