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

BeginMainMenu over other contents such as DockSpaceOverViewport #3035

Closed
DarkLight-Ent opened this issue Feb 20, 2020 · 4 comments
Closed

BeginMainMenu over other contents such as DockSpaceOverViewport #3035

DarkLight-Ent opened this issue Feb 20, 2020 · 4 comments
Labels
docking menus menu bars, menu items

Comments

@DarkLight-Ent
Copy link

DarkLight-Ent commented Feb 20, 2020

Version/Branch of Dear ImGui:

Version: v1.75
Branch:Docking

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx11.cpp
Compiler: MS Visual Studio 2019
Operating System: Windows 10

My Question:
It seems BeginMainMenuBar() overlays rest of the ImGui Content

Visual feedback
image

Here's my main menu code snippet
This is my code for testing basic main menu

ImGui::BeginMainMenuBar();
		if (ImGui::BeginMenu("File"))
		{
			ImGui::MenuItem("New");
			ImGui::MenuItem("Create");
			ImGui::EndMenu();
		}

ImGui::EndMainMenuBar();

I couldnt tell if this is a bug,or im not passing a required flag to ImGui framework.

@ocornut ocornut added the menus menu bars, menu items label Feb 21, 2020
@ocornut
Copy link
Owner

ocornut commented Feb 24, 2020

Hello,

Your code snippet is missing the fundamental fact that you are creating a window with a dock-space that fills the screen. This is where something should be adjusted, ideally you'd have said window be considerate of the fact that there is a menu bar here.

There's currently no standardized way for them to communicate that to each others, but you can create your window right under. A menu bar is always ImGui::GetFrameHeight() high, so your fullscreen window could start at viewport->Pos + ImVec2(0, ImGui::GetFrameHeight()) instead of viewport->Pos.

I would however like to get this problem solved in a more standardized and automatic manner, by providing a per-viewport mechanism of maintaining a "work area" similarly to what OS does.

@DarkLight-Ent
Copy link
Author

Hello ocornut,

Thank you for your detailed reply,before i post this issue i searched for alternative ways to solve this behaviour before i present to you.I searched for a method which sets the window depth,however i never imagined the thing i looked indexed as FrameHeight in your framework how silly of me.

I suppose i have to adjust my frames according to mainmenu begin position and i wonder what approach you will pursue on this matter in near or far future.It's my personal observation that it can be done by layering depth per-viewport or per-window.I wonder if you could let me know this approach will be a roadblock in your current framework/progress or not

@ocornut
Copy link
Owner

ocornut commented Feb 25, 2020

I don't understand why you suggest introducing the concept of depth, when by definition we are trying to get those things to not overlay each others. Anyway I have a plan ahead to make this more automatic in function like DockspaceOverViewport().

@ocornut ocornut changed the title BeginMainMenu Overlays Other Content BeginMainMenu over other contents such as DockSpaceOverViewport Feb 25, 2020
ocornut added a commit that referenced this issue Feb 26, 2020
…-bars. Fixed DocksapceOverViewport() and demo code (overlay etc) (#3035, #2889, #2474, #1542, #2109)

Clarified that BeginMenuMainBar() had an incorrect knowledge of its height (which was previously harmless).
Designed to easily allow for status bars although we don't have/use them yet, but custom code could use them.
@ocornut
Copy link
Owner

ocornut commented Feb 26, 2020

This is now fixed by 75de34e !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docking menus menu bars, menu items
Projects
None yet
Development

No branches or pull requests

2 participants