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
In my example below, I render the main menu bar only when the SDL window has focus. In the menu bar, I have a single menu and menu item to open a modal. This modal opens and behaves as expected until the window loses and regains focus, at which point the modal closes. 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!
Screenshots/Video
2021-07-13.22-44-48.mp4
Standalone, minimal, complete, and verifiable example
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();
}
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
Your Issue/Question
In my example below, I render the main menu bar only when the SDL window has focus. In the menu bar, I have a single menu and menu item to open a modal. This modal opens and behaves as expected until the window loses and regains focus, at which point the modal closes. 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!
Screenshots/Video
2021-07-13.22-44-48.mp4
Standalone, minimal, complete, and verifiable example
The text was updated successfully, but these errors were encountered: