mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-10 19:03:30 +00:00
TreeNode double clicked #1872
Labels
No labels
accidentally closed
android
backends
bug
building
clipper
coloredit
color spaces
cplusplus
data types
demo
disabled
doc
docking
dpi
drag drop
drawing/drawlist
dropped
dx12
enhancement
focus
font/text
gallery
help wanted
idle/power saving
ime
in progress
inputs
inputtext
internals
label/id and id stack
language bindings
layout
linux/bsd
menus
multi-contexts
multi-threading
multi-viewports
nav
news/info
opengl
optimization
osx/ios
overlap
plot/graph
popups
question
scrolling
selection
settings
sliders/drags
style
tables/columns
tabs
test wanted
tools
tooltips
tree
tricks & tips
useful widgets
vulkan
web
window pos/depth
window sizing
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
ocornut/imgui#1872
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I found we can use
ImGui::IsItemClicked()to handle tree node clicked event. Can we handle mouse double click event on the tree node? (e.g double click on the tree node to open the file related to it)Edit: should we have
ImGui::IsItemDoubleClicked()function?This is IsItemClicked():
Therefore you can easily call IsMouseDoubleClicked() && IsItemHovered().
The problem is that as is, a tree node will unfold on the first click unless you use the
ImGuiTreeNodeFlags_OpenOnDoubleClickorImGuiTreeNodeFlags_OpenOnArrowflag.Thanks, that solves my problem. IMHO, I still think we can have IsItemDoubleClicked. It will be IsItemDoubleClicked returns true and also the tree node toggled. There is still no logic confliction.
Since there is a solution I would like to close this issue.
Hmm, at the moment I'd prefer to resist adding many extra API entry points. We have reusable and combinable blocks so that may be enough for now? May reconsider this later. For now I'll add a comment to
IsItemClicked()in the header file to suggest that it is no other than a shortcut toIsMouseClicked() && IsItemHovered()so it would be more understandable that you could dig one level lower (and merely 2 obvious calls instead of 1) to get extra flexibility.