Option to automatically select your first Item on Start (DropDownList & AutoCompleteComboBox)

pull/413/head
LARS-LAPTOP2\larsme 2017-03-27 13:11:24 +02:00
parent 9ac4eb6969
commit b315784caf
2 changed files with 13 additions and 0 deletions

View File

@ -112,11 +112,19 @@ namespace UnityEngine.UI.Extensions
}
}
public bool SelectFirstItemOnStart = false;
public void Awake()
{
Initialize();
}
public void Start()
{
if (SelectFirstItemOnStart && AvailableOptions.Count > 0) {
ToggleDropdownPanel (false);
OnItemClicked (AvailableOptions [0]);
}
}
private bool Initialize()
{

View File

@ -107,10 +107,15 @@ namespace UnityEngine.UI.Extensions
}
}
public bool SelectFirstItemOnStart = false;
public void Start()
{
Initialize();
if (SelectFirstItemOnStart && Items.Count > 0) {
ToggleDropdownPanel (false);
OnItemClicked (0);
}
}
private bool Initialize()