Page 1 of 1
ListHeader::getSortSegment Exception
Posted: Thu Apr 07, 2005 05:28
by TheBren
I'm getting an exception when I try to add an item to a MultiColumnList:
ListHeader::getSortSegment - Sort segment was NULL! (No segments are attached to the ListHeader?)
It happens when I call MultiColumnList::insertRow().
I tried calling MultiColumnList::setSortColumn(0), same error.
I have no idea what I'm doing really. Just sorta feeling my way along. Are there any docs or samples for MultiColumnList? Anyone have any suggestions?
Thanks!
Re: ListHeader::getSortSegment Exception
Posted: Thu Apr 07, 2005 06:56
by gcarlton
Here's what I do. First, set up your columns:
Code: Select all
float fTotalWidth = 0.99f;
float fDivider = 0.70f;
m_pSettings->addColumn("Setting", COLUMN_NAME, fDivider);
m_pSettings->addColumn("Value", COLUMN_VALUE, (fTotalWidth-fDivider));
m_pSettings->setSelectionMode(CEGUI::MultiColumnList::RowSingle);
Then, add your elements:
Code: Select all
void AddSetting(int a_iIndex, const utf8* a_szName, const utf8* a_szValue, bool a_bChangedColour)
{
uint32 iRow = m_pSettings->addRow();
static uint32 s_iNormalColour = MakeXRGB(200, 200, 200);
static uint32 s_iChangedColour = MakeXRGB(200, 255, 255);
CEGUI::ListboxTextItem* pName = ANew_Gui CEGUI::ListboxTextItem(a_szName, a_iIndex);
pName->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush");
pName->setTextColours(CEGUI::colour(s_iNormalColour));
m_pSettings->setItem(pName, COLUMN_NAME, iRow);
CEGUI::ListboxTextItem* pValue = ANew_Gui CEGUI::ListboxTextItem(a_szValue, a_iIndex);
pValue->setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush");
pValue->setTextColours(CEGUI::colour(a_bChangedColour ? s_iChangedColour : s_iNormalColour));
m_pSettings->setItem(pValue, COLUMN_VALUE, iRow);
}
Re: ListHeader::getSortSegment Exception
Posted: Sun Apr 10, 2005 18:42
by TheBren
I was using CELayoutEditor to create the parent MultiColumnList and then trying to add the headers/list to the XML manually. I should probably have mentioned this.
So now I have the MultiColumnList in XML and add the columns through code as you suggested, and it works fine. Thanks!
How do I apply my own scheme? It appears to be using WindowsLook by default.