Fixed CloseCurrentPopup() on a child-menu of a modal incorrectly closing the modal. (#2308)

This commit is contained in:
omar
2019-01-27 23:54:17 +01:00
parent 13ca2fe845
commit 8a4422b2fa
3 changed files with 29 additions and 4 deletions

View File

@ -2171,13 +2171,24 @@ static void ShowDemoWindowPopups()
if (ImGui::Button("Stacked modals.."))
ImGui::OpenPopup("Stacked 1");
if (ImGui::BeginPopupModal("Stacked 1"))
if (ImGui::BeginPopupModal("Stacked 1", NULL, ImGuiWindowFlags_MenuBar))
{
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
{
if (ImGui::MenuItem("Dummy menu item")) {}
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::Text("Hello from Stacked The First\nUsing style.Colors[ImGuiCol_ModalWindowDimBg] behind it.");
// Testing behavior of widgets stacking their own regular popups over the modal.
static int item = 1;
ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
static float color[4] = { 0.4f,0.7f,0.0f,0.5f };
ImGui::ColorEdit4("color", color); // This is to test behavior of stacked regular popups over a modal
ImGui::Combo("Combo", &item, "aaaa\0bbbb\0cccc\0dddd\0eeee\0\0");
ImGui::ColorEdit4("color", color);
if (ImGui::Button("Add another modal.."))
ImGui::OpenPopup("Stacked 2");