flyover / imgui-js

JavaScript bindings for Dear ImGui using Emscripten and TypeScript
https://flyover.github.io/imgui-js/example/
MIT License
962 stars 103 forks source link

ImGui.BeginMenuBar() not displaying #58

Closed Rage997 closed 1 year ago

Rage997 commented 1 year ago

Hello guys,

I am trying to create a menubar on top of a window but no menu is displayed. I followed the example code in the Docs

ImGui.Begin("Debug");
    if ( ImGui.BeginMenuBar()) {
      if ( ImGui.BeginMenu("FIle")) {
          if (ImGui.Menuitem("Open..", "Ctrl+O")) { /* Do stuff */ }
          if (ImGui.Menuitem("Save", "Ctrl+S")) { /* Do stuff */ }
          if (ImGui.Menuitem("Close", "Ctrl+W")) { /* Do stuff */ }
          ImGui.EndMenu();
        }
      ImGui.EndMenuBar();
    }
    ImGui.End();

any help would be appreciated!

Rage997 commented 1 year ago

In case anyone else has this problem, all you have to do is to feed the correct flag ImGui.Begin("Debug", null, ImGui.WindowFlags.MenuBar); Wished this was written explicitly in the docs