Author Topic: selecting and highlighting an item in a list  (Read 3253 times)

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
selecting and highlighting an item in a list
« on: April 03, 2013, 03:43:27 PM »
I noticed that the list example (panel) doesn't select anything or highlight the items. How do I do that any example ?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: selecting and highlighting an item in a list
« Reply #1 on: April 03, 2013, 05:18:40 PM »
Add a collider to the item(s). Don't forget to UIDragPanelContents on the collider as well so that it continues dragging the panel like before.

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
Re: selecting and highlighting an item in a list
« Reply #2 on: April 03, 2013, 05:49:58 PM »
That's what I have so I'll give additional details of what I want to achieve and what I get:
When I click on an item I want it to center, highlight and also perform an action.
To perform the action I added a delegate to UICenterOnChild like so:

  1.        
  2. UICenterOnChild c = gridParent.GetComponent<UICenterOnChild> ();
  3. c.onFinished += delegate {ChooseColor ("boo");};
  4.  

But this only works after the item centers, I'd like this action to happen as soon as I click them.

laurentl

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 188
    • View Profile
    • McDROID
Re: selecting and highlighting an item in a list
« Reply #3 on: April 03, 2013, 05:58:58 PM »
I think I figured out : when you have a button that has a collider, if you add a DragContentPanel the button won't eat the event and let the user drag the button.
So then having the event sent is just a matter of setting a UIButtonMessage