Skip to content

Commit b171b2c

Browse files
Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name
Resolves: #200
1 parent a47d694 commit b171b2c

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Runtime/Scripts/Controls/ComboBox/AutoCompleteComboBox.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ public class SelectionTextChangedEvent : Events.UnityEvent<string> { }
131131
[System.Serializable]
132132
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
133133

134+
[System.Serializable]
135+
public class ItemSelectedEvent : Events.UnityEvent<string> { }
136+
134137
[System.Serializable]
135138
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
136139

@@ -141,6 +144,8 @@ public class ControlDisabledEvent : Events.UnityEvent<bool> { }
141144
public SelectionValidityChangedEvent OnSelectionValidityChanged;
142145
// fires in both cases
143146
public SelectionChangedEvent OnSelectionChanged;
147+
// fires when an item is clicked
148+
public ItemSelectedEvent OnItemSelected;
144149
// fires when item is changed;
145150
public ControlDisabledEvent OnControlDisabled;
146151

@@ -358,10 +363,10 @@ private void RebuildPanel()
358363
/// <param name="item"></param>
359364
private void OnItemClicked(string item)
360365
{
361-
//Debug.Log("item " + item + " clicked");
362366
Text = item;
363367
_mainInput.text = Text;
364368
ToggleDropdownPanel(true);
369+
OnItemSelected?.Invoke(Text);
365370
}
366371

367372
private void RedrawPanel()

0 commit comments

Comments
 (0)