Skip to content
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

Closed
colesnicov opened this issue May 7, 2017 · 2 comments
Closed

Close popup without using ImGui::CloseCurrentPopup() #1137

colesnicov opened this issue May 7, 2017 · 2 comments
Labels

Comments

@colesnicov
Copy link

Hello to everybody.

Is there a possibility to close the popup window on the way:

ImGui::OpenPopup("TEST");
ImGui::BeginPopupModal("TEST");
...
ImGui::EndPopup();


ImGui::Begin("___");
if(ImGui::Button("Close TEST popup", ImVec2(...)))
{
    // Here i want to close the popup with the name TEST
}
ImGui::End();
@colesnicov colesnicov changed the title Close popup without using ImGui::CloseCurrentPopup () Close popup without using ImGui::CloseCurrentPopup() May 7, 2017
@colesnicov
Copy link
Author

colesnicov commented May 8, 2017

Inspired from here: #249 and #528 but not #402 (comment)

I just added a boolean indice:

static bool test_open(true);

like this:

static bool test_open(true);

// Must be tested?
if(test_open){
    ImGui::OpenPopup("TEST");
}

ImGui::BeginPopupModal("TEST", &test_open);
...
ImGui::EndPopup();


ImGui::Begin("___");
if(ImGui::Button("Close TEST popup", ImVec2(...)))
{
    // Here i want to close the popup with the name TEST
    test_open = false;
}
ImGui::End();

@ocornut
Copy link
Owner

ocornut commented Aug 27, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants