imgui
imgui copied to clipboard
Popup auto-resize goes beyond windows limit if content is added
Hello,
I am using version 1.89.1, main branch, and is facing an issue with popup since some time. Basically everything is fine, but when some content is added to an existing popup then its is resized (as per ImGuiWindowFlags_AlwaysAutoResize flag), but it can grow beyond the window size (so the last widgets are not accessible nor visible).
What I would expect in this case is to resize the popup until the bottom of the window, and then add a vertical scroll bar if required.
If I close the popup and open it again, it is ok : the popup will be displayed higher on the screen so that all the content is visible. This is not a major issue, but it would be nice to have a fix to improve user experience.

Basic code in imgui_demo.cpp
// Showing a menu with toggles
if (ImGui::Button("Toggle.."))
ImGui::OpenPopup("my_toggle_popup");
if (ImGui::BeginPopup("my_toggle_popup"))
{
for (int i = 0; i < IM_ARRAYSIZE(names); i++)
ImGui::MenuItem(names[i], "", &toggles[i]);
//--- added code start ----
static bool addLines = false;
ImGui::Checkbox("add items", &addLines);
if (addLines) for (int i = 0; i < IM_ARRAYSIZE(names); i++) ImGui::MenuItem(names[i], "", &toggles[i]);
//--- added code end----
if (ImGui::BeginMenu("Sub-menu"))
{
ImGui::MenuItem("Click me");
ImGui::EndMenu();
}
Regards