You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_win32.cpp
Compiler: MSVC
Operating System: Windows 11
My Issue/Question:
What I am doing.
I have a Tree.
Every TreeNode changes color when hovered.
I open a Popup, if a TreeNode is rightcklicked.
When the Popup opens, the right-clicked TreeNode loses it's "hovered-state".
This is expected behavior, since the TreeNode is not hovered anymore.
But I want to keep that TreeNode hovered, so that it is colored like it is, as long as the Popup is opened.
There are definetly some solutions, like manually color the rightclicked TreeNode differently, but i wonder if there is a better one, like a flag to keep the hovered- and activated- states for the popup lifetime. (Because I think this is pretty common in other applications)
I think it is pretty important to show the user, which item he right-clicked.
Screenshots/Video
When Hovered: (Note that my cursor got hidden in this screenshots)
On Popup:
Standalone, minimal, complete and verifiable example:
ImGui::Begin("Example");
for (size_t i = 0; i < 5; i++) {
bool expanded = ImGui::TreeNodeEx((void*)i, 0, "Item %d", i);
if (ImGui::BeginPopupContextItem()) {
if (ImGui::BeginMenu("Option 1")) ImGui::EndMenu();
if (ImGui::BeginMenu("Option 2")) ImGui::EndMenu();
ImGui::EndPopup();
}
if (expanded) ImGui::TreePop();
}
ImGui::End();
Thanks! Have a beautiful day!
The text was updated successfully, but these errors were encountered:
I have pushed a minor amend to the Demo 156e0a8 to showcase doing this with Selectable().
We are passing the bool selected parameter to Selectable() as selected == n.
In the case of a TreeNodeEx() it would be via the ImGuiTreeNodeFlags_Selected flag:
(Tangent: As it is expected that 1.90 will finish merging the work on range/multi-select (#1861) note that in the WIP BeginMultiSelect() feature, right-clicking automatically amend selection as well.)
Version/Branch of Dear ImGui:
Version: v1.89.2 WIP
Branch: docking
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_opengl3.cpp + imgui_impl_win32.cpp
Compiler: MSVC
Operating System: Windows 11
My Issue/Question:
What I am doing.
This is expected behavior, since the TreeNode is not hovered anymore.
But I want to keep that TreeNode hovered, so that it is colored like it is, as long as the Popup is opened.
There are definetly some solutions, like manually color the rightclicked TreeNode differently, but i wonder if there is a better one, like a flag to keep the hovered- and activated- states for the popup lifetime. (Because I think this is pretty common in other applications)
I think it is pretty important to show the user, which item he right-clicked.
Screenshots/Video
When Hovered: (Note that my cursor got hidden in this screenshots)
On Popup:
Standalone, minimal, complete and verifiable example:
Thanks! Have a beautiful day!
The text was updated successfully, but these errors were encountered: