Added extra event on the AutoCompleteComboBox, to fire when an item in the list is selected, with its display name
Resolves: https://github.com/Unity-UI-Extensions/com.unity.uiextensions/issues/200pull/460/head
parent
a47d694796
commit
b171b2c1c2
|
@ -131,6 +131,9 @@ namespace UnityEngine.UI.Extensions
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
|
public class SelectionValidityChangedEvent : Events.UnityEvent<bool> { }
|
||||||
|
|
||||||
|
[System.Serializable]
|
||||||
|
public class ItemSelectedEvent : Events.UnityEvent<string> { }
|
||||||
|
|
||||||
[System.Serializable]
|
[System.Serializable]
|
||||||
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
|
public class ControlDisabledEvent : Events.UnityEvent<bool> { }
|
||||||
|
|
||||||
|
@ -141,6 +144,8 @@ namespace UnityEngine.UI.Extensions
|
||||||
public SelectionValidityChangedEvent OnSelectionValidityChanged;
|
public SelectionValidityChangedEvent OnSelectionValidityChanged;
|
||||||
// fires in both cases
|
// fires in both cases
|
||||||
public SelectionChangedEvent OnSelectionChanged;
|
public SelectionChangedEvent OnSelectionChanged;
|
||||||
|
// fires when an item is clicked
|
||||||
|
public ItemSelectedEvent OnItemSelected;
|
||||||
// fires when item is changed;
|
// fires when item is changed;
|
||||||
public ControlDisabledEvent OnControlDisabled;
|
public ControlDisabledEvent OnControlDisabled;
|
||||||
|
|
||||||
|
@ -358,10 +363,10 @@ namespace UnityEngine.UI.Extensions
|
||||||
/// <param name="item"></param>
|
/// <param name="item"></param>
|
||||||
private void OnItemClicked(string item)
|
private void OnItemClicked(string item)
|
||||||
{
|
{
|
||||||
//Debug.Log("item " + item + " clicked");
|
|
||||||
Text = item;
|
Text = item;
|
||||||
_mainInput.text = Text;
|
_mainInput.text = Text;
|
||||||
ToggleDropdownPanel(true);
|
ToggleDropdownPanel(true);
|
||||||
|
OnItemSelected?.Invoke(Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RedrawPanel()
|
private void RedrawPanel()
|
||||||
|
|
Loading…
Reference in New Issue