mirror of
https://github.com/ocornut/imgui.git
synced 2026-10-22 22:44:21 +00:00
Selectable capturing click and not forwarding to other widgets #517
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#517
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?
Hello,
I have a question regarding 'Selectable' : I use it to select a full line in a table (please see the capture below).
As Selectable capture the mouse-click, all the other widgets don't react anymore to the mouse clic ; I cannot enable/disable checkboxes, I cannot expand combo, etc.
Does someone know a simple way to make Selectable forward the mouse-click event instead of capturing it ?
Thanks for your help
So this a little tricky.
Do you want to have the line selected when a checkbox/combo is used?
Are you using selectable just as a visual aid or a permanent selection?
If you call SetItemAllowOverlap() after Selectable() other items will be usable. However in this context Selectable() will react to mouse-release, so if another widget is active (e.g. clicked on the checkbox) it'll steal activity from the Selectable and as a result Selectable won't return true.
If you want the line selection to happens you can set the selection yourself when the other widgets are activated. You'd need to include imgui_internal.h to use SetItemAllowOverlap() but I've been considering moving it to imgui.h
Thank you very much !
Calling SetItemAllowOverlap() just after Selectable() provides a behaviour better than the one I expected.
I'm able to select a line and continue to modify another line at the same time. Perfect :)
I have pushed a bunch of changes related to AllowOverlap mode.
See this comment for details: https://github.com/ocornut/imgui/issues/6512#issuecomment-1611369198
TL;DR;
SetItemAllowOverlap()couldn't work since 1.89 and was obsoleted.SetNextItemAllowOverlap(). It doesn't need an internal button flags and should work across most/all widgets.IsItemHovered()aware of this (previously it wasn't) with opt-out flagImGuiHoveredFlags_AllowWhenOverlappedByItem.xxxAllowItemOverlapflags toxxxAllowOverlap.