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

Avoid mouse mask when using popup. #3929

Closed
Gringoniceguy opened this issue Mar 17, 2021 · 5 comments
Closed

Avoid mouse mask when using popup. #3929

Gringoniceguy opened this issue Mar 17, 2021 · 5 comments

Comments

@Gringoniceguy
Copy link

Gringoniceguy commented Mar 17, 2021

Version/Branch of Dear ImGui:

Version: bf497d2
Branch: Shadow (Using master doesn't fix this issue.)

Back-end/Renderer/Compiler/OS

Back-ends: imgui_impl_dx9.cpp + imgui_impl_win32.cpp
Compiler: MSVC2019
Operating System: Windows 10

My Issue/Question:

I am trying to make a sort of snackbar, i would like to-do this using popups, but i dont want to capture mouse inputs, it just needs to be a top window.
Is there any way to avoid capturing mouse inputs to-do this or should i make this myself?

Standalone, minimal, complete and verifiable example: (see #2261)

ImGui::OpenPopup(text); //Open popup
if (ImGui::BeginPopup(text)) //Begin popup
{
	ImGui::Text("Test text"); //Some example text to make the popup bigger.
        ImGui::EndPopup(); //End it
}
@Gringoniceguy
Copy link
Author

Oops did too little searching in the issues i found have found a issue which references this (#718), but i found that using a primitive drawlist implementation is much better performance wise and was easy to make.

@ocornut
Copy link
Owner

ocornut commented Mar 18, 2021

Is there any way to avoid capturing mouse inputs to-do this or should i make this myself?

There is a ImGuiWindowFlags_NoInputs flag you could pass to Begin() or BeginPopup() as well.

ImGuiWindowFlags_NoInputs = ImGuiWindowFlags_NoMouseInputs | ImGuiWindowFlags_NoNavInputs | ImGuiWindowFlags_NoNavFocus,

@Gringoniceguy
Copy link
Author

Gringoniceguy commented Mar 18, 2021

Well a snackbar should be able to have a button which using no input would not allow, there is also the thing when you press any button the pop-up closes.
So using a regular window/child-window or a primitive drawlist solution is most likely the best.
My mistake i was just thinking it would be easier using a pop-up for this.

@ocornut
Copy link
Owner

ocornut commented Mar 18, 2021

Do you mean that you wanted inputs to reach the window BUT also to reach other windows around/behind it? In which case, yes, the purpose of popups is specifically to disallow the later as they are designed to be closed by clicking outside of their bounds. So if I understand this properly, yes, using a regular windows would work.

@Gringoniceguy
Copy link
Author

Yes that is my intent, i just got a bit of tunnel vision on using popups for this.

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

No branches or pull requests

2 participants