mirror of
https://github.com/ocornut/imgui.git
synced 2026-11-10 19:03:30 +00:00
Is Combo() meant to return "true" even if current_item does not change? #1182
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#1182
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?
Hi,
I am trying out Combo, and it feels like I don't want to run code if the selected option does not change, but if I click on it, no matter what I choose I will always get true as return value.
A trivial change to the code saving current item at the top and checking at the very end does the job for me, but I was just wondering if this was the expected behavior and what was the rationale for it.
Just to clarify, I understand that when I click outside the combo it returns false, this question is only about clicking the same option that was selected before.
thanks!
Francisco
You are correct that at the moment, if you click the same option again it will return true. The consistent behaviour over widgets has been to do that, but it is certainly debatable. We could change/fix that.
FYI the change would be turning:
Into
Great!, thanks. I have just started using it, so now I know what to expect in that particular case.
If someone is using that true value as some sort of reload mechanism of whatever is selected, then the change could affect them significantly, so I can totally live with the way it works now :)
The change is fairly sensible but I would have to think about the consequences on user codebases.
I think a future better Combo() API may want to introduce flags to select that sort of behavior.
In one of my projects I use combo as a navigation and if I select something already selected, the page refreshes. If the behaviour is changed, I can no longer do that. On the other hand if it stays the same I can still do
old_value != new_value.Thanks Mikulas. Will leave it as is for now, took note that we could expose this behavior later/somehow.
Sorry, I didn't know if I was meant to close this or not, then I saw Mikulas comment and re-opened it but I am happy with the answers.
I have eventually pushed this change for consistency. Commit:
a02315e.In the event someone needs this for reloading, they can use the flexibility of the
BeginCombo()api.