Author Topic: Problem Tile View Using WrapContent  (Read 4955 times)

aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Problem Tile View Using WrapContent
« on: August 30, 2016, 02:37:00 PM »
i m making tile view using WrapContent
it is responsive but when size changed , items go away from screen
gif https://we.tl/59aKYrltRY

and this is pkg
https://we.tl/5zC0nuS61V

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #1 on: August 30, 2016, 09:42:29 PM »
Did you check the last NGUI example scene, one that uses UIWrapContent? The windows there are resizable, and the content stays within the scroll views. What are you doing differently?

aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #2 on: August 31, 2016, 12:51:34 PM »
i have arranged Items as you mentioned i other posts

http://www.tasharen.com/forum/index.php?topic=14688.msg64173#msg64173
http://www.tasharen.com/forum/index.php?topic=8936.0

"If you need multiple rows, then organize your content like this:

UIWrapContent
- Row 1 (UIGrid)
-- Item 1
-- Item 2
-- Item 3
- Row 2 (UIGrid)
-- Item 4
-- Item 5
-- Item 6 "

plz take a look on ListBase

but in nutshell

when window resize ,


if(heightReized)
{
   if(rowCount > CurrentRowCount)
  {
    CreateNewRow();
   wrapContent.SortAlphabetically();
  }
}



if(widthResized)
{
    if(columCount > currentColumCount)
   {
      CreateOrActiveItems();
   }
   else
  {
      DeactiveItems();
  }

   RefreshRowGrids();
   RefreshItemsData();
   wrapContent.SortAlphabetically();
}




There All things are working fine ,Items ,rows Are being created as it should but it scrollView get off from screen when it resized.
   






aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #3 on: September 01, 2016, 12:44:42 PM »
there?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #4 on: September 03, 2016, 02:07:02 AM »
Your hierarchy view only has 4 items under the wrap content, but your game view shows a lot more of them. Make sure you have enough items to display the content properly. Also I don't understand where the logic comes for choosing how many items you have per row? Is that the code you posted from what you called ListBase? Where is it called from? I'm guessing you have a conflict with your ListBase code and UIWrapContent's functionality there.

aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #5 on: September 04, 2016, 07:26:26 AM »
yes there are 4 or 5 items (depends upon screen height) but these items have children like

UIWrapContent
- Row 1 (UIGrid)
-- Item 1
-- Item 2
-- Item 3
- Row 2 (UIGrid)
-- Item 4
-- Item 5
-- Item 6 "


as you have sceen ListBase is Parent Class for List , and it have all functionality that list has to use.

CreateItemRendrersVertically() // to create Row
InstentiateItems()                   //to create row children

CreateOrDeavtivateItems()      //to active or create more Row children if needed


plz take a look on ListBase , where you will find all these functions , also do watch that animation , you will find whats my problem is.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #6 on: September 05, 2016, 08:21:22 AM »
I just noticed you included a package -- sorry I missed it in the original post. Unfortunately it isn't stand-alone. It doesn't compile, with errors like
  1. Assets/script/NGUITMProBridge.cs(3,7): error CS0246: The type or namespace name `TMPro' could not be found. Are you missing a using directive or an assembly reference?
I did watch the animation, but without a clear repro case to look at, I can only guess as to what's wrong.

I did notice that you seem to be using smooth grid animation on line 433 of ListBase.cs. I'd turn that off as the first thing to try. You're re-positioning things manually. Smooth animation is only going to cause issues for you.

aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #7 on: September 06, 2016, 04:27:26 AM »
Sorry for inconvenience and Thank you very much  for giving me your precious time.
I m sending project again , this time its contain simple scripts , no inheritance.



1- ListTileView                             // to set data on items
2-ListTileViewItemsManager         //to create items in tile or list
3- ItemRendererListTileView         //to set data on item



i m not having any issue regarding grid animation ,
the issue is https://we.tl/9Wos9uUEhN



and pkg is https://we.tl/TKvLVPw9KZ


 
« Last Edit: September 06, 2016, 05:15:05 AM by aammfe »

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #8 on: September 09, 2016, 01:43:54 PM »
There's a missing script on the Scroll View and 2D UI, and you have SpringPanel on it for some reason. I'm also getting a lot of errors on application stop about destroying transforms, and one about not cleaning up objects when closing the scene. I fixed the latter by removing "DestroyItemRenderers()" call in the list tree items OnDestroy.

The app itself seems to work fine if I don't move the scroll view. When I resize the window down, the number of columns gets reduced. When I resize the window up though, the number of columns doesn't go up until I hover the mouse over an item in the scroll view -- but it works as expected. Now, if I scroll the content down, then I start seeing the disappearing issue. In fact it doesn't actually disappear -- it simply stays where it is. The number of columns gets increased, which leads to content being above the visible boundary after you reposition the items. If you select the scroll view and zoom out the scene view, you can see it.

That should give you a pretty good clue as to how to fix the issue. Simply adding "scrollView.ResetPosition();" call to your OnPanelChanged function fixed it.

P.S. Your items have Mesh Filters on them for some reason with mesh set to null. Not sure why you did that...

  1.         private void OnPanelChanged ()
  2.         {
  3.                 if (listTileView.dataProvider == null) return;
  4.  
  5.                 var needVerticallyRefresh = false;
  6.                 var needHorizontallyRefresh = false;
  7.  
  8.                 if (height != listPanel.height)
  9.                 {
  10.                         height = listPanel.height;
  11.                         needVerticallyRefresh = CreateItemRendrersVertically();
  12.                 }
  13.  
  14.                 if (width != listPanel.width)
  15.                 {
  16.                         width = listPanel.width;
  17.                         needHorizontallyRefresh = CreateOrDeavtivateItems();
  18.                 }
  19.  
  20.                 if (needVerticallyRefresh || needHorizontallyRefresh)
  21.                 {
  22.                         CheckWrapContent();
  23.                         RefeshCurrentItems();
  24.                         scrollView.ResetPosition(); // <----
  25.                 }
  26.         }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #9 on: September 09, 2016, 01:46:11 PM »
One more thing... why is OnPanelChanged in your panel's geometry updated callback? That's a very wrong place to put it. It should be simply in Update().

aammfe

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Problem Tile View Using WrapContent
« Reply #10 on: September 09, 2016, 07:23:06 PM »
 thanx for replying   :)

;) fortunately just before reading you post , i  resolve how to do it ,


scrollView.ResetPosition(); reset scroll to "0",
which i dont want ,every time i change device rotation and list resets to "0"

i used scrollView.RestrictWithinBounds(true); it worked perfectly for me, but it change scrollView.transform.localPosition.x , some time ,
so i have to reset "x" to zero



i was trying to use textMeshPro With NGUi that's why Mesh Filters where there


yes there is problem some time you have to click and then items are being created and arranged i think it is because of onGeometryUpdated
but
there is no way to catch resize from panel , so i have to use onGeometryUpdated
i always avoid, to write code in update , if there are  10 panel in my scene means in every update same code is being run?


can you update NGUI so we can listen these types of events easily.