Reputation: 41
I have the following code. A window pops up, but the menu bar does not. What am I doing wrong?
ImGui::Begin("Example Window");
// Create a menu bar
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("Menu"))
{
ImGui::MenuItem("Console");
}
ImGui::EndMenuBar();
}
ImGui::End();
Any help would be much appreciated.
Upvotes: 0
Views: 976
Reputation: 145
You will need to set window flag with menu bar enabled:
if (ImGui::Begin("Example Window", nullptr, ImGuiWindowFlags_MenuBar)) {
// Create a menu bar
if (ImGui::BeginMenuBar())
{
if (ImGui::BeginMenu("Menu"))
{
ImGui::MenuItem("Console");
}
ImGui::EndMenuBar();
}
ImGui::End();
}
Upvotes: 0