Possible bug with UIScrollList and AddItem ?

Possible bug with UIScrollList and AddItem ?

Postby xyber » Thu Feb 17, 2011 10:57 am

I'm creating a chat interface that uses various channels. I use panels to contain all the elements related to a channel, like the UIScrollList with the chat messages in it.
When I receive a message from the server I add it to the UIScrollList it belongs to and this is where the problem comes in.
Whenever I add a message to a UIScrollList all the messages in that list becomes visible even though the panel is hidden/inactive.

I've attached some images to show what is happening. Notice in the Hierarchy view how the UILItsItems are now active after I've added a new message to a panel that should be hidden.
chat01.jpg


and this is how messed up it looks because the "general" channel's text is now showing while it should have stayed hidden.
chat00.jpg
xyber
 
Posts: 45
Joined: Wed Jan 26, 2011 12:21 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby Brady » Thu Feb 17, 2011 11:00 pm

I think I have a fix for this I'd like you to test if you like. PM me with your e-mail address and I'll send it along. Thanks!
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby xyber » Mon Feb 21, 2011 2:15 pm

Another one to do with scroll list. Maybe not a bug and just me setting something up wrong but I have no idea how to fix this.
The first item in the list has a shorter selection bar than the rest.

Image22.png
xyber
 
Posts: 45
Joined: Wed Jan 26, 2011 12:21 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby Brady » Mon Feb 21, 2011 10:31 pm

That all depends on how the item is composed. Can you describe, in as much detail as possible, how the list item is constructed and added to the list?
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby xyber » Tue Feb 22, 2011 9:52 am

This is the function to add the user names to the list ...
cci.users.CreateItem(chatUserItemFab, n);
where cci.users is a reference to the scrolllist.

Code: Select all
public void IrcOnNames(object sender, NamesEventArgs e)
{   // received list of names for a channel
   ChatChannelInfo cci = chatChannels[e.Channel.ToLower()];
   if (cci != null)
   {
      // clean the names and add to usernames list
      cci.usernames.Clear();
      foreach (string n in e.UserList)
      {
         if (!string.IsNullOrEmpty(n)) cci.usernames.Add(CleanIrcUserName(n));
      }

      // sort names
      cci.usernames.Sort();

      // add them to the gui list
      cci.users.ClearList(true);
      foreach (string n in cci.usernames)
      {
         cci.users.CreateItem(chatUserItemFab, n);
      }
   }      
}


and some pix, 1) The list item prefab and 2) the text cotrol text for the item

01.png


00.png
xyber
 
Posts: 45
Joined: Wed Jan 26, 2011 12:21 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby xyber » Tue Feb 22, 2011 10:04 am

Fixed it, my Item width was 140 but the list was set to a width of 130. So the first item got clipped as it probably should. Don't know why the rest did not get clipped though.

[edit] ok. that was not the problem, maybe partly. I used a transparent 16x16 sprite for the "normal" state of an item and then two other 16x16 sprites for the over and selected states. I had "trim" on when building the sprite atlas so I guess the transparent sprite became nothingness :P and somehow messed things up. I turned off "trim images" and everything is nice now.
xyber
 
Posts: 45
Joined: Wed Jan 26, 2011 12:21 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby Brady » Tue Feb 22, 2011 7:29 pm

On the clipping, yes, only items at the end of the list are clipped. This is for performance reasons since it is assumed you won't create items that are wider than the list itself, since there would be no way to view the portions beyond the edges otherwise. So as an optimization, only the items at the ends of the viewable area are clipped.

On the trimmed sprite issue, 100% transparent sprites should be detected and placed on the atlas as a 2x2 transparent image. So I'm not entirely sure why that would cause a problem, since your items are manually sized (not using pixel-perfect). Perhaps try turning trimming back on and change the anchor method from TEXTURE_OFFSET to MIDDLE_CENTER. It could be that since the image is 100% blank, it is somehow throwing off the offset.
Brady
 
Posts: 5361
Joined: Tue Jul 06, 2010 11:33 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby xyber » Wed Feb 23, 2011 11:34 am

Seems to work. I turned trim images back on and selected middle_center as you suggested and the offsets seems fine.
xyber
 
Posts: 45
Joined: Wed Jan 26, 2011 12:21 pm

Re: Possible bug with UIScrollList and AddItem ?

Postby valamun » Sun Apr 15, 2018 3:09 pm

ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514ac22514
ac22514
valamun
 
Posts: 32549
Joined: Sat Mar 17, 2018 5:46 pm


Next

Return to EZ GUI General

Who is online

Users browsing this forum: No registered users and 6 guests

cron