Page 1 of 1
Problems with the 'MultiColumnList' Widget
Posted: Thu Feb 24, 2005 11:11
by Legolas1681
Okay, I've created and populated a multi-column list, but I end up with the following:
http://qmx.dnsalias.com/private/screenshot1.png
Is there anyway that the items can line up across the rows instead of the first 5 items being on rows 1-5 and the next 5 being on rows 6-10? Any help would be greatly appreciated.
Re: Problems with the MultiColumnList Widget
Posted: Thu Feb 24, 2005 17:53
by spannerman
Try using the addRow method to get the last row, then use that to add your columns. I havent tested this code, but you should get the idea:
Code: Select all
/*
Where
- mcl is your MultiColumnList
- itmCol is a ListboxTextItem
- sel_img is your selection image
*/
int newRow;
// First Row
itmCol = new ListboxTextItem("item 1a");
itmCol->setSelectionBrushImage(sel_img);
newRow = (int)mcl->addRow(itmCol,0);
itmCol = new ListboxTextItem("item 1b");
itmCol->setSelectionBrushImage(sel_img);
mcl->setItem(itmCol, 1, newRow);
// Second Row
itmCol = new ListboxTextItem("item 2a");
itmCol->setSelectionBrushImage(sel_img);
newRow = (int)mcl->addRow(itmCol,0);
itmCol = new ListboxTextItem("item 2b");
itmCol->setSelectionBrushImage(sel_img);
mcl->setItem(itmCol, 1, newRow);
Hope that helps
Re: Problems with the MultiColumnList Widget
Posted: Thu Feb 24, 2005 19:19
by CrazyEddie
Yeah, basically it's a (common) problem of understanding...
addRow does just that; it adds a row. You then need use setItem to set other items in the row as shown in spannermans code above.
CE
Re: Problems with the MultiColumnList Widget
Posted: Thu Feb 24, 2005 19:59
by Legolas1681
Ahhh... ::enlightenment:: Thanx alot guys! Works great now.
BTW, great job so far Eddie. I can't wait to see the other great features you implement next.
Re: Problems with the MultiColumnList Widget
Posted: Mon Feb 28, 2005 02:56
by Legolas1681
Okay, now I've noticed there seems to be a bug in the multi-column list. When I have a large list that needs a vertical scrollbar, the last item in the list usually gets clipped like so:
http://qmx.dnsalias.com/private/screenshot1.png
Also, I've noticed that on long lists (with or without a scrollbar) the click-coords become inacurate the lower to the bottom of the list you get. For example, I'll click almost near the middle of one item, but the item directly below it will become selected instead. In the following screenshot, the point of the MouseCursor is where I clicked, but you can see that the item below the one I clicked got selected:
http://qmx.dnsalias.com/private/screenshot2.png
I've also noticed the above undesired behavior in other widgets that use scrollbars ( i.e. the multi-column editbox ).
Just thought I'd let you know so you can look into it.
Re: Problems with the MultiColumnList Widget
Posted: Mon Feb 28, 2005 09:45
by CrazyEddie
Thanks for the report. This is probably linked to a similar issue in the standard Listbox widget. I have an idea what's causing these issues, if I am correct and it's an easy fix I'll do it over the next day or two.
CE.
Re: Problems with the MultiColumnList Widget
Posted: Mon Feb 28, 2005 10:48
by CrazyEddie
Could you please try this patch and let me know if it resolves the issue for you.
Code: Select all
Index: src/elements/CEGUIListboxTextItem.cpp
===================================================================
RCS file: /cvsroot/crayzedsgui/cegui_mk2/src/elements/CEGUIListboxTextItem.cpp,v
retrieving revision 1.6
diff -u -r1.6 CEGUIListboxTextItem.cpp
--- src/elements/CEGUIListboxTextItem.cpp 5 Feb 2005 09:08:56 -0000 1.6
+++ src/elements/CEGUIListboxTextItem.cpp 28 Feb 2005 10:45:49 -0000
@@ -92,8 +92,8 @@
if (fnt != NULL)
{
- tmp.d_height = fnt->getLineSpacing();
- tmp.d_width = fnt->getTextExtent(d_itemText);
+ tmp.d_height = PixelAligned(fnt->getLineSpacing());
+ tmp.d_width = PixelAligned(fnt->getTextExtent(d_itemText));
}
return tmp;
Thanks.
Re: Problems with the MultiColumnList Widget
Posted: Tue Mar 01, 2005 02:25
by Legolas1681
Oh yeah! Fixed it right up perfectly! Amazing how modifying two lines of code can make such a difference.
Re: Problems with the MultiColumnList Widget
Posted: Tue Mar 01, 2005 14:02
by CrazyEddie
Cool. This fix has been put into CVS for both 0.2.0 and HEAD.