Author Topic: Scrollable Table, update entries  (Read 3216 times)

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Scrollable Table, update entries
« on: January 29, 2014, 09:13:04 AM »
Hi everybody,

I'm trying to create a scrollable table with entries that are updated at the beginning. It works ok so far, but I have a weird error. This is my structure:

- Panel (UIPanel + UIScrollView)
    -Table (UITable)
       - Entry 1 (BoxCollider + UIDragScrollView)
       - Entry 2 (BoxCollider + UIDragScrollView)
       - ...

  1. for(int i=0; i<myCount; i++)
  2.         {
  3.                 GameObject g = Instantiate(MyGameObject) as GameObject;
  4.                 g.SetActive(true);
  5.                 g.transform.parent = myTable.transform;
  6.                 g.transform.localScale = Vector3.one;
  7.                 g.name=MyGameObject.name;
  8.                 }
  9.                 myTable.Reposition();
  10.  

The problem is that the entries don't show up altough they are there. They are somehow invisible, but they appear one I start to scroll/drag the entries.

Any ideas? Any help would be appreciated.
Thanks and best regards,
Matthias


Cripple

  • TNP Alpha
  • Full Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Scrollable Table, update entries
« Reply #1 on: January 29, 2014, 09:17:39 AM »
You have to use the methods in NGUITools.XXX() instead of the method of Unity to make it work (NGUITools.Instantiate, NGUITools.SetActive, NGUITools.Destroy, ...)
Graphicstream Dev.

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Scrollable Table, update entries
« Reply #2 on: January 29, 2014, 09:29:27 AM »
Thanks for your quick answer Cripple, but that didn't solve the problem... Still weird that the entries become visible only if I drag them...

Cripple

  • TNP Alpha
  • Full Member
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 117
    • View Profile
Re: Scrollable Table, update entries
« Reply #3 on: January 29, 2014, 09:33:34 AM »
Can you copy paste your code pls?
Graphicstream Dev.

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Scrollable Table, update entries
« Reply #4 on: January 29, 2014, 09:39:56 AM »
I tried this code (since there seems to be not NGUITools.Instantiate):

  1.  
  2. for(int i=0; i<myCount; i++)
  3. {
  4.         GameObject g = NGUITools.AddChild(par.gameObject, friendEntry);
  5.         NGUITools.SetActive(g, true);
  6. }
  7.        
  8. par.Reposition();
  9.  

Also I play around a little bit more and it seems to be a problem with the alpha clipping of the panel. If I switch it off the entries are displayed from the beginning... hmm... strange

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Scrollable Table, update entries
« Reply #5 on: January 29, 2014, 09:48:11 AM »
I just tried this:

  1. if(Input.GetKeyDown(KeyCode.A))
  2. {
  3. if(myPanel.clipping==UIDrawCall.Clipping.None)
  4. myPanel.clipping = UIDrawCall.Clipping.AlphaClip;
  5. else
  6. myPanel.clipping = UIDrawCall.Clipping.None;
  7. }
  8.  

I set the clipping mode to none and then back to AlphaClip the Entries show. Do I have to reset the clipping mode if I update the table or something? Thanks.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollable Table, update entries
« Reply #6 on: January 29, 2014, 10:10:42 AM »
What version of NGUI are you using?

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Scrollable Table, update entries
« Reply #7 on: January 29, 2014, 10:15:48 AM »
I'm using "v3.0.8 f4".

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Scrollable Table, update entries
« Reply #8 on: January 29, 2014, 10:17:38 AM »
That explains it. Please update. And in the future always update first, post later.

langem

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 8
    • View Profile
Re: Scrollable Table, update entries
« Reply #9 on: January 29, 2014, 10:28:22 AM »
Thanks. That fixed it and you're right... I'll update more often ;)