ListBox and MultiListBox question

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
zander1976
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 08, 2005 13:32
Contact:

ListBox and MultiListBox question

Postby zander1976 » Tue Jul 19, 2005 15:01

Hello Everybody,

I have a few questions with regards to working with ListBoxes. Hopefully someone will have an idea of what I need to do. I have look threw the api docs and did some forum searching but I am still having problems.

1. MultiColumnList - if I understand correct gives me the ability to:
Name Score
whatever 10

It takes a ListboxTextItem so how do I add more elements (ie the score)?

2. Also how do i set the col that will actually be sorted? The sort option takes true of false.

3. Can I assign and ID to the row for example:
Player Name
whatever

Can I assign an id now ( I tried assigning id in ListboxTextItem ) but there is no method to that I could find that says findItemWithId?

4. ListBoxTitles. Ok I am completely lost with these :(
I used the gui editor to create listbox and a listboxtitle (it was in the list of windows I could create in the gui editor) but its not visible and not attached to the listbox at all. Is there a way to do this. Do I have to attach it in the code.

Sorry for so many questions I have tried to look them up myself and figure each out but man ce is big. I am amazed by how much it can do and for the most part is quite easy to use.

Thanks in advance for any help.
Ben

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: ListBox and MultiListBox question

Postby CrazyEddie » Wed Jul 20, 2005 08:33

Hi,

1) Yes, this is correct. To set items in the grid, you specify the column id and row index, or use a MCLGridRef. Basically you add the columns you want, then add a row and set the items within the row with setItem

2) setSortColumnByID is one way.

3) Yes, this ability was added for 0.3.0. See setRowID

4) If you mean the ListHeader, these are automatically created when you add a column to your multi-column list. You do not need to create them manually, unless you're creating a new widget type. See addColumn

Hope this answers some of your questions :)

User avatar
zander1976
Just popping in
Just popping in
Posts: 7
Joined: Fri Apr 08, 2005 13:32
Contact:

Re: ListBox and MultiListBox question

Postby zander1976 » Thu Jul 21, 2005 12:22

Ahh sweet.. Thank you very much CE for your help and for CEGUI.. :)

Ben

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: ListBox and MultiListBox question

Postby Van » Fri Sep 23, 2005 19:25

Am I to understand that EACH COLUMN[/u] must have its own [i]ListboxTextItem ??

Please correct me if I am wrong:

Code: Select all

 CEGUI::ListboxTextItem *mMyItems[3];
 ...
 mRowNum = mMyMCListBox->addRow();
 MyMCListBox->setItem(mMyItems[0], 0, mRowNum);
 MyMCListBox->setItem(mMyItems[1], 1, mRowNum);
 mMyMCListBox->setItem(mMyItems[2], 2, mRowNum);


Is that the jist of it it? Or do I have it all wrong?

And, what happens/what do you do in a drag and drop scenerio?

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: ListBox and MultiListBox question

Postby Van » Sat Sep 24, 2005 15:22

OK, I have the MultiColumnListBox working - sort of... My problem is I can't select any of the row items. I am probably not setting something correcty...

Code: Select all

   // LIST BOX
   strcat( mStr, "/MultiColumnList" );
   mListBox = (CEGUI::MultiColumnList *)mWinMgr->createWindow(
      (CEGUI::utf8*)CEGUILOOK"/MultiColumnList", (CEGUI::utf8*)mStr);
   mListBox->addColumn("Serial No.",      0, 0.25f);
   mListBox->addColumn("Name",            1, 0.25f);
   mListBox->addColumn("Qty",            2, 0.25f);
   mListBox->addColumn("Category",         3, 0.25f);
   mListBox->setPosition( CEGUI::Point(0.05f, 0.1f) );
   mListBox->setSize( CEGUI::Size(0.90f, 0.80f) );
   mListBox->setSelectionMode(CEGUI::MultiColumnList::SelectionMode::RowMultiple);
   mListBox->setColumnHeaderWidth(0, 0.25f);
   mListBox->setColumnHeaderWidth(1, 0.25f);
   mListBox->setColumnHeaderWidth(2, 0.25f);
   mListBox->setColumnHeaderWidth(3, 0.25f);

   // TEST
   unsigned int mRow = mListBox->addRow();
   CEGUI::ListboxTextItem* item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"12345", 0);
   mListBox->setItem(item, 0, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Name1", 1);
   mListBox->setItem(item, 1, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"17", 2);
   mListBox->setItem(item, 2, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Resource1", 3);
   mListBox->setItem(item, 3, mRow);
   //-
   mRow = mListBox->addRow();
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"234", 4);
   mListBox->setItem(item, 0, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"name2", 5);
   mListBox->setItem(item, 1, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"45", 6);
   mListBox->setItem(item, 2, mRow);
   item = new CEGUI::ListboxTextItem((CEGUI::utf8*)"Resource2", 7);
   mListBox->setItem(item, 3, mRow);
   // TEST


Anyone see why I can't select a row?

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Re: ListBox and MultiListBox question

Postby Van » Sat Sep 24, 2005 16:21

never mind. Stupid me forgot to set the setSelectionBrushImage for each item. :oops:

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: ListBox and MultiListBox question

Postby CrazyEddie » Sun Sep 25, 2005 09:07

Van wrote:
Am I to understand that EACH COLUMN[/u] must have its own [i]ListboxTextItem ??

Each individual entry in the grid requires its own item.

Van wrote:
And, what happens/what do you do in a drag and drop scenerio?

In the current system, items are not based on the Window class, and do not natively support drag and drop.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 5 guests