1
0
mirror of https://github.com/ocornut/imgui.git synced 2024-11-30 18:34:34 +01:00

Combo: Made simple/legacy Combo() function not returns true when picking already selected item. (#1182)

This commit is contained in:
ocornut 2023-06-28 15:47:10 +02:00
parent 6137443d24
commit a02315e1c4
3 changed files with 3 additions and 2 deletions

View File

@ -88,6 +88,8 @@ Other changes:
- CollapsingHeader/TreeNode: Fixed text padding when using _Framed+_Leaf flags. (#6549) [@BobbyAnguelov]
- InputText: Fixed not returning true when buffer is cleared while using the
ImGuiInputTextFlags_EscapeClearsAll flag. (#5688, #2620)
- Combo: Made simple/legacy Combo() function not returns true when picking already selected item.
This is consistent with other widgets. If you need something else, you can use BeginCombo(). (#1182)
- Clipper: Rework inner logic to allow functioning with a zero-clear constructor.
This is order to facilitate usage for language bindings (e.g cimgui or dear_binding)
where user may not be callinga constructor manually. (#5856)

View File

@ -167,7 +167,6 @@ It's mostly a bunch of personal notes, probably incomplete. Feel free to query i
- drag float: added leeway on edge (e.g. a few invisible steps past the clamp limits)
- combo: use clipper.
- combo: flag for BeginCombo to not return true when unchanged (#1182)
- combo: a way/helper to customize the combo preview (#1658) -> experimental BeginComboPreview()
- combo/listbox: keyboard control. need InputText-like non-active focus + key handling. considering keyboard for custom listbox (pr #203)
- listbox: multiple selection (WIP range-select branch)

View File

@ -1926,7 +1926,7 @@ bool ImGui::Combo(const char* label, int* current_item, bool (*items_getter)(voi
const char* item_text;
if (!items_getter(data, i, &item_text))
item_text = "*Unknown item*";
if (Selectable(item_text, item_selected))
if (Selectable(item_text, item_selected) && *current_item != i)
{
value_changed = true;
*current_item = i;