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

Make a specific window always on top #3693

Closed
MRDuzzz opened this issue Jan 3, 2021 · 2 comments
Closed

Make a specific window always on top #3693

MRDuzzz opened this issue Jan 3, 2021 · 2 comments

Comments

@MRDuzzz
Copy link

MRDuzzz commented Jan 3, 2021

Version/Branch of Dear ImGui:
Version: v1.67 WIP
Branch: master

My Issue/Question:
How can I do an ImGui::Begin stay always on top. I have 2 ImGui::Begins calls and When they cross, one of them draws over the other, I want one to always stay above the other. How can I do that?

Well, Idk if you will understand my explanation, I'll attach a screenshot of the issue in this thread.

The second Begin is drawing above my First Begin:
unknown

Thank you and Happy New Year.

@ocornut
Copy link
Owner

ocornut commented Jan 3, 2021

It's unclear from your screenshot what the dear imgui window (Begin calls) correspond to.
You can use GetForegroundDrawList() if all you need is to render ImDrawList primitives, (GetOverlayDrawList in 1.67).

There's no AlwaysOnTop setting for windows but if you have a limited numbers of windows you can use ImGuiWindowFlags_NoBringToFrontOnFocus on the other window as well.

@ocornut ocornut changed the title Make a specific Begin always on top Make a specific window always on top Jan 13, 2021
@ocornut
Copy link
Owner

ocornut commented Jan 13, 2021

Closing as answered
Linking to #1328, #983, #1892

The issue with a using a flag called "Always On Top" is when you have more than one window with the same flag you get an ambiguity. If we expose arbitrary z/depth settings (either as named enums or absolute flexible) it ends to quickly escalate toward extremes (literally toward the top) + it makes sharing code from different sources more difficult. I don't there is one perfect solution to this problem. Maybe we'll expose a finite number of named layer and allow windows within a same layer to be z-reordered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants