Skip to content

Popup sized improperly when too big #5843

@ypujante

Description

@ypujante

I have this use case where I am displaying a popup window and when the content is too big (vertically) the bottom is truncated as can be seen in the screenshot:

Screen Shot 2022-11-01 at 11 40 23

The way I open the popup:

  auto title = "my popup";
  if(!ImGui::IsPopupOpen(title))
    ImGui::OpenPopup(title);

  if(ImGui::BeginPopupModal(title, nullptr, ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_HorizontalScrollbar))
  {
    // large number of ImGui::Text();
    // separator
    // ok button to close the popup
  }

I believe the issue is because I am using a "main menu bar": the popup cannot be moved on top of the main menu bar (in the screenshot, you can see that this is the most I can move the popup up) and so it seems that the code is not accounting for the dimension of the main menu bar

My code does something like (trimmed):

  if(ImGui::BeginMainMenuBar())
  {
    ...
  }
  ImGui::DockSpaceOverViewport(ImGui::GetMainViewport());
  // display popup

Info about Dear ImGui:

Dear ImGui 1.89 WIP (18828)
--------------------------------
sizeof(size_t): 8, sizeof(ImDrawIdx): 2, sizeof(ImDrawVert): 20
define: __cplusplus=201703
define: __APPLE__
define: __GNUC__=4
define: __clang_version__=13.0.0 (clang-1300.0.29.30)
define: IMGUI_HAS_VIEWPORT
define: IMGUI_HAS_DOCK
--------------------------------
io.BackendPlatformName: imgui_impl_glfw
io.BackendRendererName: imgui_impl_metal
io.ConfigFlags: 0x00000040
 DockingEnable
io.ConfigViewportsNoDecoration
io.ConfigMacOSXBehaviors
io.ConfigInputTextCursorBlink
io.ConfigWindowsResizeFromEdges
io.ConfigWindowsMoveFromTitleBarOnly
io.ConfigMemoryCompactTimer = 60.0
io.BackendFlags: 0x0000140E
 HasMouseCursors
 HasSetMousePos
 PlatformHasViewports
 RendererHasVtxOffset
 RendererHasViewports
--------------------------------
io.Fonts: 1 fonts, Flags: 0x00000000, TexSize: 512,256
io.DisplaySize: 1280.00,720.00
io.DisplayFramebufferScale: 2.00,2.00
--------------------------------
style.WindowPadding: 8.00,8.00
style.WindowBorderSize: 1.00
style.FramePadding: 4.00,3.00
style.FrameRounding: 0.00
style.FrameBorderSize: 0.00
style.ItemSpacing: 8.00,4.00
style.ItemInnerSpacing: 4.00,4.00

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions