-
-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
Context menu on docked window tab #7914
Comments
How are you doing that? Because |
I'm using ImGui::IsWindowHovered() right after Begin() as you suggested in #316 (comment). That was from 2015 so it's possible there's a better way now :) |
If I use ImGui::IsItemHovered(), the popup appears as expected even when the window is docked. But as soon as I let go of the right mouse button, the popup vanishes. It seems I need to right click then hold the right button down and move the mouse into the popup before releasing for the popup to stay open. |
Please provide an explicit repro because this works here: ImGui::Begin("Hello, world!");
if (ImGui::BeginPopupContextItem())
{
ImGui::MenuItem("Hello");
ImGui::EndPopup();
}
ImGui::End(); Docked or not docked. |
if(!ImGui::Begin(GetID().c_str(), &open, ImGuiWindowFlags_NoScrollWithMouse))
{
//tabbed out, don't draw anything until we're back in the foreground
ImGui::End();
return true;
}
//Check for right click on the title bar
if(ImGui::IsItemHovered() && ImGui::IsMouseClicked(ImGuiMouseButton_Right))
{
auto rect = ImGui::GetCurrentWindow()->TitleBarRect();
if(ImGui::IsMouseHoveringRect(rect.Min, rect.Max, false))
ImGui::OpenPopup("Rename Group");
}
if(ImGui::BeginPopup("Rename Group"))
{
ImGui::InputText("Name", &m_title);
ImGui::EndPopup();
}
ImGui::End(); |
The IsMouseHoveringRect seems to be redundant if using IsItemHovered() and I removed it with no change to behavior. |
Confirmed, using IsMouseReleased() to spawn the popup fixes the immediate problem. Keeping this ticket open until you find and fix the focus bug, you can close once that's finished. Thanks :) |
Again you don't need to call
|
Even better, works like a charm. |
…d have the side-effect of e.g. closing popup on a mouse release. (#7914)
Pushed a fix/workaround for the mouse release issue 8c4dceb but I will need to investigate this a little further. |
…d have the side-effect of e.g. closing popup on a mouse release. (#7914) + Debug Log: add details about closed popups.
Closing this after confirming. |
Version/Branch of Dear ImGui:
1.90.7 WIP 19063
Back-ends:
vulkan
Compiler, OS:
gcc/Debian
Full config/build information:
No response
Details:
I want to be able to spawn a context menu by right clicking the tab widget of a docked window.
As of now, I'm able to create a context menu on the title bar when a window is not docked, but haven't found any way to detect a right click on the tab widget of the docked window. Is this currently possible?
Screenshots/Video:
No response
Minimal, Complete and Verifiable Example code:
No response
The text was updated successfully, but these errors were encountered: