[haiku-3rdparty-dev] Changing the color of a text sequence in a BTextView

  • From: Robert Stiehler <r.stiehler85@xxxxxxxxxxxxxx>
  • To: haiku-3rdparty-dev@xxxxxxxxxxxxx
  • Date: Mon, 28 Nov 2011 17:47:19 +0100

Hi,

I try to change the color of a text sequence in a BTextView, but it didn't
works like expected. If I try to change it, the complete text in the
BTextView changes his color.
That is the way i tried it:


BTextView *_txtMessages = new BTextView(....);

...
_txtMessages->Insert("you> ");

text_run_array* txtRunArr =
_txtMessages->RunArray(_txtMessages->TextLength() - strlen("you> "),
strlen("you> "));
txtRunArr->runs->color.blue = 255;
_txtMessages->SetRunArray(_txtMessages->TextLength() - strlen("you> "),
strlen("you> "), txtRunArr);
...

The result of this code is that the complete text in the BTextView
"_txtMessages" become blue, but what i want is that just the "you> "
becomes blue. Knows someone what i do wrong?

regards,
Robert

Other related posts: