-
-
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
Close popup without using ImGui::CloseCurrentPopup() #1137
Comments
Inspired from here: #249 and #528 but not #402 (comment) I just added a boolean indice:
like this:
|
I would still like to add popup apis using ImGuiID (they'd have a behave very slightly differently because functions like ClosePopup() would need to scan the popup stack). Linking to #331 for reference. |
Hey, is there any news about a I want to implement a "Loading..." animation in my application via a modal popup. I have a global thread-safe counter ( // called every frame
if (m_LoadingCounter == 0 && !m_IsWindowOpen)
return;
if (!m_IsWindowOpen) {
ImGui::OpenPopup(WINDOW_TITLE_ID);
m_IsWindowOpen = true;
}
// ...
if (ImGui::BeginPopupModal(WINDOW_TITLE_ID, nullptr, WINDOW_FLAGS)) {
// ...
if (m_LoadingCounter == 0) {
ImGui::CloseCurrentPopup();
m_IsWindowOpen = false;
}
ImGui::EndPopup();
} This would be much easier with a // called every frame
const bool windowOpen = ImGui::IsPopupOpen(WINDOW_TITLE_ID);
if (m_LoadingCounter == 0) {
if (windowOpen)
ImGui::ClosePopup(WINDOW_TITLE_ID);
return;
}
if (!windowOpen)
ImGui::OpenPopup(WINDOW_TITLE_ID);
// ...
if (ImGui::BeginPopupModal(WINDOW_TITLE_ID, nullptr, WINDOW_FLAGS)) {
// ...
ImGui::EndPopup();
} |
I will look into it but I think what’s missing here is a way to make a window modal without it being a popup. If you control both opening and closing it doesn’t have to be a popup. Modals are a bit ill designed currently. Linking to #402 |
Hello to everybody.
Is there a possibility to close the popup window on the way:
The text was updated successfully, but these errors were encountered: