[solved] MultiColumnList: fast change text in all items
Posted: Thu Mar 19, 2009 13:52
Hi to all and thanks to Crazy Eddie for project..
I'm new in forum but I have just raised a minimum experience with CEGUI.
I'm use this GUI into SFML project of a small(for now) / nice game similar to Monopoly (started in 1990 or before with GWBasic ^_^)
Now I have some beginner problem with MultiColumnList.
I just generated it as in general examples / sample but
I don't found good/clear code for necessity after generated grid:
How can I quick change text in all items
example: I have a table with 5 players data to update at every frames because is a Debug window and data as position change continuously.
I don't think that recreating item object at every frame is so efficient, or not?
I see in http://www.cegui.org.uk/wiki/index.php/ ... ColumnList:
Second part of code can help me to point to items for change that? or what?
I need to make some as:
in http://www.cegui.org.uk/phpBB2/viewtopi ... columnlist:
I think that
GridReference stand for original creation sequence position or visual position after some user column move?
Looking at first code reported..
can I use item reference codifing as 102 for row=1 column=2
to find item after creation?
in http://www.cegui.org.uk/phpBB2/viewtopi ... columnlist
Ok, I think it is the best method but first I need code to change all texts
Thanks for patience boys.
I'm new in forum but I have just raised a minimum experience with CEGUI.
I'm use this GUI into SFML project of a small(for now) / nice game similar to Monopoly (started in 1990 or before with GWBasic ^_^)
Now I have some beginner problem with MultiColumnList.
I just generated it as in general examples / sample but
I don't found good/clear code for necessity after generated grid:
How can I quick change text in all items
example: I have a table with 5 players data to update at every frames because is a Debug window and data as position change continuously.
I don't think that recreating item object at every frame is so efficient, or not?
I see in http://www.cegui.org.uk/wiki/index.php/ ... ColumnList:
Code: Select all
itemMultiColumnList = new ListboxTextItem("A2", 201);
itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
multiColumnList->setItem(itemMultiColumnList, 0, 1); // ColumnID, RowID
itemMultiColumnList = new ListboxTextItem("B2", 202);
itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
multiColumnList->setItem(itemMultiColumnList, 1, 1); // ColumnID, RowID
itemMultiColumnList = new ListboxTextItem("C2", 203);
itemMultiColumnList->setSelectionBrushImage("TaharezLook", "MultiListSelectionBrush");
multiColumnList->setItem(itemMultiColumnList, 2, 1); // ColumnID, RowID
Code: Select all
MCLGridRef grid_ref(1, 0); // Select according to a grid reference; second row
multiColumnList->setItemSelectState(grid_ref, true);
ListboxItem* listboxItem = multiColumnList->getFirstSelectedItem();
uint valueColumnA = listboxItem->getID(); // Retrieve the value of the selected item from column A
listboxItem = multiColumnList->getNextSelected(listboxItem);
uint valueColumnB = listboxItem->getID(); // Retrieve the value of the selected item from column B
listboxItem = multiColumnList->getNextSelected(listboxItem);
uint valueColumnC = listboxItem->getID(); // Retrieve the value of the selected item from column C
Second part of code can help me to point to items for change that? or what?
I need to make some as:
Code: Select all
for r = 0 to 5;
// Column Name unchanged
mcl -> getItemAt( r, 1 ) -> setText( tostring(someVarA) );
mcl -> getItemAt( r, 2 ) -> setText( tostring(someVarB) );
mcl -> getItemAt( r, 3 ) -> setText( tostring(someVarC) );
//..
next;
in http://www.cegui.org.uk/phpBB2/viewtopi ... columnlist:
Code: Select all
If you want to find an item with a specified string, you can use MultiColumnList::findListItemWithText which you pass in a string and get back a pointer to the item.
If you have the item and want the grid location, you can use MultiColumnList::getItemGridReference
If these answers are no good, please specify what information you have that you can pass as input, and what you want back as output.
I find CEGUI::getItemAtGridReference
I think that
Code: Select all
findListItemWithText in my code can slow down
getItemGridReference reverse
ListboxItem * getItemAtGridReference (const MCLGridRef &grid_ref) const
Return a pointer to the ListboxItem at the specified grid reference.
GridReference stand for original creation sequence position or visual position after some user column move?
Looking at first code reported..
can I use item reference codifing as 102 for row=1 column=2
to find item after creation?
in http://www.cegui.org.uk/phpBB2/viewtopi ... columnlist
Code: Select all
you can edit multiple items before having to do a redraw which is more efficient. Its a basic transaction mechanism.
I can confirm the reason for non-automatic updates is for efficiency reasons.
BTW, the correct member to notify of changes is CEGUI::MultiColumnList::handleUpdatedItemData
Ok, I think it is the best method but first I need code to change all texts
Thanks for patience boys.