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

OpenPopup does not work in MainMenuBar #1146

Closed
JJscott opened this issue May 17, 2017 · 2 comments
Closed

OpenPopup does not work in MainMenuBar #1146

JJscott opened this issue May 17, 2017 · 2 comments
Labels

Comments

@JJscott
Copy link
Contributor

JJscott commented May 17, 2017

When writing MenuItems in the MainMenuBar, OpenPopup does not trigger the Popup to be open.

Minimum example where the Popup will not open:

	if (ImGui::BeginMainMenuBar())
	{
		if (ImGui::BeginMenu("Test Popup"))
		{
			if (ImGui::MenuItem("Open Popup"))
			{
				ImGui::OpenPopup("Some Popup");
			}
			ImGui::EndMenu();
		}
		ImGui::EndMainMenuBar();
	}

	if (ImGui::BeginPopup("Some Popup"))
	{
		ImGui::Text("Hello World");
		ImGui::EndPopup();
	}

Minimum example where the Popup will open:

	bool open_popup = false;
	if (ImGui::BeginMainMenuBar())
	{
		if (ImGui::BeginMenu("Test Popup"))
		{
			if (ImGui::MenuItem("Open Popup"))
			{
				open_popup = true;
			}
			ImGui::EndMenu();
		}
		ImGui::EndMainMenuBar();
	}

	if (open_popup ) ImGui::OpenPopup("Some Popup");

	if (ImGui::BeginPopup("Some Popup"))
	{
		ImGui::Text("Hello World");
		ImGui::EndPopup();
	}
@ocornut
Copy link
Owner

ocornut commented May 17, 2017 via email

@ocornut ocornut closed this as completed May 17, 2017
@ocornut
Copy link
Owner

ocornut commented May 17, 2017

The link is #331. Closed for duplicate.
Still working on figuring out a nice solution for this.

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