You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add the code below to example_sdl_opengl3 and launch the example
Select File -> Open Modal in the menu bar
Click off the main viewport window (the menu bar will disappear)
Click back on the main viewport window
bool open_modal = false;
if (SDL_GetMouseFocus()) {
if (ImGui::BeginMainMenuBar()) {
if (ImGui::BeginMenu("File")) {
open_modal = ImGui::MenuItem("Open Modal");
ImGui::EndMenu();
}
ImGui::EndMainMenuBar();
}
}
if (open_modal) {
ImGui::OpenPopup("Modal");
}
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f));
if (ImGui::BeginPopupModal("Modal", NULL, ImGuiWindowFlags_AlwaysAutoResize)) {
if (ImGui::Button("Close")) {
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
Expected Behavior
The menu bar reappears and the modal stays open.
Actual Behavior
The menu bar reappears, but the modal closes unexpectedly.
2021-07-13.22-44-48.mp4
Other Details
I want to render the main menu bar only when the SDL window has focus. Ideally, the modal would remain open until I call ImGui::CloseCurrentPopup(). I'm wondering if I'm misusing modals or if this is possible a bug. Is there a preferred way to implement this behavior?
Apologies if this is a redundant question. I see #331, but my question is more of a tangent from the discussion in that issue.
Thank you for taking a look!
The text was updated successfully, but these errors were encountered:
Version
1.84 WIP (18302)
Branch
master
Platform Backend
imgui_impl_sdl
Renderer Backend
imgui_impl_opengl3
Compiler
No response
Operating System
Ubuntu 20.04
Steps to Reproduce
example_sdl_opengl3
and launch the exampleFile -> Open Modal
in the menu barExpected Behavior
The menu bar reappears and the modal stays open.
Actual Behavior
The menu bar reappears, but the modal closes unexpectedly.
2021-07-13.22-44-48.mp4
Other Details
I want to render the main menu bar only when the SDL window has focus. Ideally, the modal would remain open until I call
ImGui::CloseCurrentPopup()
. I'm wondering if I'm misusing modals or if this is possible a bug. Is there a preferred way to implement this behavior?Apologies if this is a redundant question. I see #331, but my question is more of a tangent from the discussion in that issue.
Thank you for taking a look!
The text was updated successfully, but these errors were encountered: