Author Topic: dynamically move item to scroll view doesn't display it  (Read 1609 times)

superp

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 14
    • View Profile
dynamically move item to scroll view doesn't display it
« on: March 20, 2014, 03:00:34 AM »
I have 2 scroll views side by side.
I am using code
  1. if(lastSelectedItem.Left) // buy
  2.                 {
  3.                         lastSelectedItem.transform.parent = RightGridControl.transform;
  4.                         lastSelectedItem.GetComponent<UIDragScrollView>().scrollView = RightScrollViewControl.GetComponent<UIScrollView>();
  5.                 }
  6.                 else //sell
  7.                 {
  8.                         lastSelectedItem.transform.parent = LeftGridControl.transform;
  9.                         lastSelectedItem.GetComponent<UIDragScrollView>().scrollView = LeftScrollViewControl.GetComponent<UIScrollView>();
  10.                 }
  11.                 lastSelectedItem.transform.localScale = new Vector3 (1, 1, 1);
  12.  
  13.  
  14.                 leftGrid.Reposition ();
  15.                 rightGrid.Reposition ();
  16.  
  17.                 LeftScrollViewControl.GetComponent<UIScrollView>().UpdatePosition();
  18.                 LeftScrollViewControl.GetComponent<UIPanel> ().Refresh ();
  19.                 RightScrollViewControl.GetComponent<UIScrollView>().UpdatePosition();
  20.                 RightScrollViewControl.GetComponent<UIPanel> ().Refresh ();

This is called when a button is clicked and it does move an item from one UIGrid in one scrollview to UIGrid in another scrollview and UIGrid calculates correctly but the item simply doesn't get displayed.
I am calling Refresh on the scrollview control. What am i doing wrong?
The attached picture is supposed to show 2 items, but the 2nd one isn't displaying

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: dynamically move item to scroll view doesn't display it
« Reply #1 on: March 20, 2014, 12:33:45 PM »
What are you trying to do? Move an item from one scroll view to another? Whenever you change the parent of a widget, you MUST call "MarkParentAsChanged".