Author Topic: Long Popup List  (Read 23769 times)

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Long Popup List
« on: October 28, 2012, 05:07:46 AM »
h!
I want to implement popup list with long list.
I searched in the forum on that but found no suitable answer.

When I add very long list in the popup list and exceeds the screen height, I doesn't scroll it.
So I decide to implement like following.


Could you tell me with any hint or example how i can implement it?
Thank you,
Adam.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile

Darky

  • Guest
Re: Long Popup List
« Reply #2 on: October 28, 2012, 02:15:06 PM »
I'd appreciate some helpers for this, too. I would have to disagree that it's a UI Design issue. For example not everyone uses the Unity launcher and a scrollable list would be immensely helpful for configuring a few things in-game, specifically the resolution. Try populating a list with Screen.resolutions and build & run it, you'll see it's no fun.

Personally I hope for a implementation of this feature in a future NGUI Version. Are there any plans for this? Or has anyone managed to imitate a functionality like this and is willing to share his code or give some pointers as to how it was accomplished?

Thanks

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #3 on: October 28, 2012, 08:25:42 PM »
I agree with Darky that many people who use NGUI need that control especially in PC.
In http://www.unity3dkorea.com/ and http://www.devkorea.co.kr/ - Korean site for unity, this problem is discussed seriously too. (I am a NGUI helper in that site, and have to say the resolution.)

I really hope that NGUI would include that control or example in next version.

Thank you,
Best Regards,
Adam.

« Last Edit: October 28, 2012, 08:28:17 PM by adam718 »

noob22

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 38
    • View Profile
Re: Long Popup List
« Reply #4 on: October 28, 2012, 08:29:33 PM »
I'd appreciate some helpers for this, too. I would have to disagree that it's a UI Design issue. For example not everyone uses the Unity launcher and a scrollable list would be immensely helpful for configuring a few things in-game, specifically the resolution. Try populating a list with Screen.resolutions and build & run it, you'll see it's no fun.

Personally I hope for a implementation of this feature in a future NGUI Version. Are there any plans for this? Or has anyone managed to imitate a functionality like this and is willing to share his code or give some pointers as to how it was accomplished?

Thanks

I agree with you!

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #5 on: November 14, 2012, 07:30:39 AM »
Hi! Aren.
I made combobox style Popup list.
I am wondering if you allow me to upload code snippet?


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Long Popup List
« Reply #6 on: November 14, 2012, 11:52:30 AM »
Certainly. Feel free to just attach the file here (assuming it's one or two files, and doesn't include NGUI in it).

Anadin

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Long Popup List
« Reply #7 on: December 10, 2012, 05:05:20 PM »
Hey Adam, are still going to upload snippets?

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #8 on: December 16, 2012, 09:40:21 PM »
I am really sorry for late reply.
I was busy that I couldn't attach my files.
Now I decided to remake it cause what I have done is that scroll only with mouse wheel.
Now I am going to make it scrollable with mouse click(touch) & drag.

I will upload it soon ^*^.

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #9 on: December 26, 2012, 05:11:55 AM »
Hi Aren!
I upload my made "Long Popup List".
I changed following.
1. removed Hilight because of position of item.
2. destroy popup list panel only when click item & click others. (originally it was destroyed when selected.)
3. show scroll only when dragging because of some problem.

I will try to fix and make it more comfortable to use in the future.
I hope you of all find problems and share it with me.
Thank you,
Adam.
« Last Edit: December 26, 2012, 05:34:44 AM by adam718 »

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #10 on: December 26, 2012, 08:10:43 AM »
I upgraded UIPopupListEx.
change log
- put selected item on the top of the popup panel.

current problem
- when I select same item in the item list and drag up & down, it doesn't destroy when click other control.
   I hope Aren see this problem and give me a hint.

Thank you.
« Last Edit: December 26, 2012, 08:20:52 AM by adam718 »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Long Popup List
« Reply #11 on: December 26, 2012, 11:07:21 AM »
The closing of the popup list happens when it gets OnSelect(false). Initially the popup list is given focus by setting UICamera.selectedObject, and when it loses it by clicking elsewhere, it gets OnSelect(false), which then closes it.

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #12 on: December 26, 2012, 11:32:15 AM »
Thank you very much Aren for your reply.

That's right.
But when I click item and drag it inside panel, panel loses its focus so that OnSelect(false) is called.
So I didn't close it in OnSelect(false).
That's why my problem above occurs I think.

I hope there is a solution.

adam718

  • Jr. Member
  • **
  • Thank You
  • -Given: 2
  • -Receive: 0
  • Posts: 60
    • View Profile
Re: Long Popup List
« Reply #13 on: December 26, 2012, 11:44:41 AM »
I guess I found the reason.
It's not because of clicking & dragging same item.
It's because of order of calling callback.
    void OnItemPress(GameObject go, bool isPressed)
    {
        m_bPanelSelected = isPressed;
    }

    void OnItemSelect(GameObject go, bool isSelected)
    {
        if (!m_bPanelSelected && !isSelected)
            DestroyPopup(false);
    }

As you can see every item uses same callback.
So I don't know exactly whether current item gets lost focus by "other control", or by "prev item"
What I mean is when I click & drag item A and secondly item B, then A gets lost focus otherwise B gets focus.
But they are all processed in one callback.
So my problem occurs.

I'll try keep thinking on that more.

Thank you Aren for your hint.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Long Popup List
« Reply #14 on: December 26, 2012, 12:06:12 PM »
Select needs to be given to the parent (or the scroll bar), not an individual item. It's that parent or scroll bar that will react to OnSelect(false).