Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: devomage on July 06, 2015, 05:27:53 PM

Title: UIPopup problem within scrollview
Post by: devomage on July 06, 2015, 05:27:53 PM
i have a drag-able scrollview (with grid) that i am using for a properties list.

the popup menu in UIPopup definitely does not behave correctly while in a scrollview.  not just near the bottom/top, etc.

the screenshot shows near the bottom of the scrollview.  the popup has about a dozen items and only the top few show.

i can give more details if needed but this should be easily re-created.  please fix!
Title: Re: UIPopup problem within scrollview
Post by: devomage on July 06, 2015, 05:54:35 PM
in this case, the popup menu is not even showing up.

ill make a side project and attach.
Title: Property Grid Example
Post by: devomage on July 06, 2015, 06:35:48 PM
attached is a property grid example NGUI-style!

i just started on it today - its clunky, beware...

- import the package in a new project
- import the latest version of NGUI

- i made the grid quite a bit larger than the above screenshots to ensure sizing was not an issue.
Title: Re: UIPopup problem within scrollview
Post by: ArenMook on July 06, 2015, 08:47:37 PM
If you have a popup list inside a scroll view, you won't want to attach UIPopupList to all the items inside. It would be way too much overhead, and the list will get clipped by the scroll view's boundaries, which is not what you want. Instead, create a popup list that uses its own panel that lies on top of your scroll view. When clicking on an item, show this generic popup list instead. I did this in Windward and greatly simplified my UI in the process.

For example:
  1. void OnClick ()
  2. {
  3.         UIPopupList popup = UIGameWindow.popupList; // <-- this is my generic, statically available popup list
  4.         popup.Clear();
  5.         popup.AddItem(Localization.Get("Dismiss"), "Dismiss");
  6.         EventDelegate.Set(popup.onChange, delegate() { ai.followTarget = null; });
  7.         popup.Show();
  8. }
Title: Re: UIPopup problem within scrollview
Post by: devomage on July 06, 2015, 10:22:07 PM
this is working very nice!

is there an easy way to position the uipopuplist on the object that was clicked to open it?
Title: Re: UIPopup problem within scrollview
Post by: ArenMook on July 08, 2015, 06:33:34 PM
You need to set the popup list to open on "Manual", and it will automatically reposition itself when you do a Show().
Title: Re: UIPopup problem within scrollview
Post by: devomage on July 12, 2015, 09:33:24 PM
working nicely!  thanks!

im not seeing an easy way to get at the bbcode toggle when using the above setup...

smiley's bad!
Title: Re: UIPopup problem within scrollview
Post by: ArenMook on July 14, 2015, 11:27:51 PM
Put a space between 1: and D, or remove this smiley from the font.
Title: Re: UIPopup problem within scrollview
Post by: devomage on July 29, 2015, 04:58:24 PM
the above solution works great if the popuplist only has a few (less than 10 or so) items.

what about when the popuplist exceeds the height of the screen?

i'm assuming a scrollable popuplist?  is there one of those handy?

too bad there isnt "max items" and then the popuplist goes to scroll-mode.
Title: Re: UIPopup problem within scrollview
Post by: ArenMook on July 31, 2015, 09:49:34 PM
From a UI design perspective if you end up with a popup list so long it has to scroll, you really should rethink what you are doing... This is the one reason I never added it, although there have been users who created their own scrollable lists in the past. It's pretty simple. Instead of using UIPopupList, show a scroll view that you will populate just before opening it. Works best when the scroll view is already set up as you need it to be, just happens to be hidden or disabled before you show it.
Title: Re: UIPopup problem within scrollview
Post by: devomage on August 03, 2015, 04:47:48 AM
From a UI design perspective if you end up with a popup list so long it has to scroll, you really should rethink what you are doing... This is the one reason I never added it, although there have been users who created their own scrollable lists in the past. It's pretty simple. Instead of using UIPopupList, show a scroll view that you will populate just before opening it. Works best when the scroll view is already set up as you need it to be, just happens to be hidden or disabled before you show it.

"From a UI design perspective", how would you deal with large lists (20-200 items)?

i came up with a scrollable list that works...  but wouldnt mind it being a bit more elegant.
Title: Re: UIPopup problem within scrollview
Post by: ArenMook on August 05, 2015, 08:35:41 AM
I wouldn't use a popup for them. I'd just make a scroll view.
Title: Re: UIPopup problem within scrollview
Post by: devomage on August 05, 2015, 02:19:10 PM
i noticed the endless scrollview might be useful for this.  appreciate the advice!