Page 1 of 1

[SOLVED]ListBoxItem setText() problem

Posted: Wed Jul 13, 2011 12:37
by Rampage
Hi, i have implemented this code for setting text values in multicolumn list items.

all items are class: ListBoxTextItem

Code: Select all

for (it = m_db.begin(); it < m_db.end(); it++)
   {
      if (it->m_idPrefix == idPrefix)
      {
         it->m_score++;
         char text[20];
         sprintf(text,"%d",it->m_score);
         unsigned int rowIndex = m_mclScore->getRowWithID(it->GetIdPrefix());
         CEGUI::ListboxItem * item = m_mclScore->getItemAtGridReference(CEGUI::MCLGridRef(rowIndex,1));
         item->setText(text); //problem here
         break;
      }
   }



My problem is, when i call setText on object item. First time, everything is ok, text in item changes to what i want. But second,third, etc..., the text stays the value, that it was in first call.
This code implements score table values changing, when player gets point. Where is the problem? i Tried everything.

Re: ListBoxItem setText() problem

Posted: Wed Jul 13, 2011 19:00
by Jamarr
Did you try calling m_mclScore->handleUpdatedItemData() after your code finishes updating the item data?

Re: ListBoxItem setText() problem

Posted: Thu Jul 14, 2011 09:14
by Rampage
thx, solved :)