Support => NGUI 3 Support => Topic started by: Antiloco on January 09, 2014, 04:15:09 AM
Title: PopUpList
Post by: Antiloco on January 09, 2014, 04:15:09 AM
Hi all,
I'm using UIPopUpList with some item (item1,item2,item3). I have the necessity to show popup with the value set to empty, the first time that I show this control. I set UIPopUpList.value="" and works fine, but the when i click on popup to make a choice, Highlight sprite is shown outside item list area. I have looked UIPopUpList.cs code at Onclick method, and I understand that happen because empty value doesn't matches any values in item list.
TO solve this I have modified script in this way
// Move the selection here if this is the right label if (mSelectedItem == s || i==0) Highlight (lbl, true);
adding OR with i variable , I highlight the first item if there isn't correspondence with popup value and popup list.
it is the correct way or is there another solution?
Thanks
Title: Re: PopUpList
Post by: ArenMook on January 09, 2014, 07:15:46 PM
It sounds fine, but I can't check right now as I'm on vacation.
Title: Re: PopUpList
Post by: Antiloco on January 29, 2014, 03:01:27 AM
I have recently updated my NGUI version and , obviously , the update has overwritten my changes in UIPopList.cs Is there a way to obtain the same result without change UIPopList.cs script?
Thanks.
Title: Re: PopUpList
Post by: ArenMook on January 29, 2014, 09:26:23 AM
The popup list isn't meant to have the selected item's value be nothing. Even with your change, it breaks controller-based input. No selected item, what do up/down arrows do? I suggest always defaulting to the first item in the list instead.
Add this right above the "// Run through all items and create labels for each one"