Author Topic: Programattic Control of built-in NGUI widgets  (Read 2686 times)

Waurelius

  • Guest
Programattic Control of built-in NGUI widgets
« on: August 17, 2013, 07:24:47 PM »
I'm trying to use the PopupList widget you get through the template for a bit of custom UI.  I have a small button in the top right that I would like to activate and open a PopupList elsewhere.  I don't see a good way to interact with the UIPopupList script programatically since all the functions are private, and I'm not sure how to (for example) send an OnClick event to it so it will open.  Is there an approved way to do this sort of thing?  Short of editing UIPopupList myself that is.

Waurelius

  • Guest
Re: Programattic Control of built-in NGUI widgets
« Reply #1 on: August 17, 2013, 07:48:03 PM »
I'll note that I found I could get these called by using the Unity GameObject.SendMessage() API, but now I'm just compounding hack upon hack, as manually sending OnClick bypasses whatever logic is keeping track of collider state for sending the OnSelect message later, so I need to SendMessage for OnSelect(false) later as well. 

The whole thing seems pretty ugly.  I'm starting to feel like I should just derive my own UIPopupList.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Programattic Control of built-in NGUI widgets
« Reply #2 on: August 18, 2013, 07:05:27 AM »
If I was doing what you're doing, I wouldn't use the popup list. Instead I'd create a panel of what I want my selection items to be, and open this panel in a location of my choice when some button is clicked on.