Author Topic: Problem when using colored text in example 12(chat window)  (Read 2364 times)

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Problem when using colored text in example 12(chat window)
« on: February 21, 2013, 03:11:42 AM »
I am trying to make a good chat window and encountered a problem about chrome text:

when using inputed many character, text will be wrapped so that it can fit the max width.
however, if the first line which contain the color info such as [FF00FF] is scrolled up, the rest character will become default color.

So is there any solution?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem when using colored text in example 12(chat window)
« Reply #1 on: February 21, 2013, 04:36:28 AM »
Yeah - don't use that chat window. :) It's just a very basic example. Consider simply adding labels to a UITable. With a lineWidth property set you will get the word wrapping properly.

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: Problem when using colored text in example 12(chat window)
« Reply #2 on: February 21, 2013, 09:14:52 PM »
Yeah - don't use that chat window. :) It's just a very basic example. Consider simply adding labels to a UITable. With a lineWidth property set you will get the word wrapping properly.

Thanks for your answers , however multi-labels will also encounter this problems for because of the height limitation which will remove the first line of the text which contains [ffffff].

 I have already implement a lot of functions through this method, multi-lines hyperline and size automatic adjusting dynamic emotions for example, So, I want find a expedient way. Can you give me any suggestion?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Problem when using colored text in example 12(chat window)
« Reply #3 on: February 21, 2013, 09:35:57 PM »
I mean just add the entire labels to the table. Don't do text wrapping yourself. Don't create multiple labels like the chat window example does.

galuodo

  • Jr. Member
  • **
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 65
    • View Profile
Re: Problem when using colored text in example 12(chat window)
« Reply #4 on: February 22, 2013, 01:01:22 AM »
I've solved it by using UIPanel's clipping. It is a great function ;D
« Last Edit: February 22, 2013, 01:04:33 AM by galuodo »