Menus: fixed closing a menu inside a popup/modal. Fixed menu inside a popup/modal not inhibiting hovering of items in the popup/modal. (#3496, #4797)

Fixed sub-menu items inside a popups from closing the popup (debatable).
This commit is contained in:
ocornut
2021-12-13 19:46:01 +01:00
parent a528398c77
commit 48f263336b
5 changed files with 58 additions and 12 deletions

View File

@ -3345,11 +3345,26 @@ static void ShowDemoWindowPopups()
}
// Call the more complete ShowExampleMenuFile which we use in various places of this demo
if (ImGui::Button("File Menu.."))
if (ImGui::Button("With a menu.."))
ImGui::OpenPopup("my_file_popup");
if (ImGui::BeginPopup("my_file_popup"))
if (ImGui::BeginPopup("my_file_popup", ImGuiWindowFlags_MenuBar))
{
ShowExampleMenuFile();
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("File"))
{
ShowExampleMenuFile();
ImGui::EndMenu();
}
if (ImGui::BeginMenu("Edit"))
{
ImGui::MenuItem("Dummy");
ImGui::EndMenu();
}
ImGui::EndMenuBar();
}
ImGui::Text("Hello from popup!");
ImGui::Button("This is a dummy button..");
ImGui::EndPopup();
}