Problems with the 'MultiColumnList' Widget

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
Legolas1681
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Jan 28, 2005 00:32

Problems with the 'MultiColumnList' Widget

Postby Legolas1681 » Thu Feb 24, 2005 11:11

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.

User avatar
spannerman
Home away from home
Home away from home
Posts: 330
Joined: Wed Jan 12, 2005 12:06

Re: Problems with the MultiColumnList Widget

Postby spannerman » Thu Feb 24, 2005 17:53

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

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

Re: Problems with the MultiColumnList Widget

Postby CrazyEddie » Thu Feb 24, 2005 19:19

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

User avatar
Legolas1681
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Jan 28, 2005 00:32

Re: Problems with the MultiColumnList Widget

Postby Legolas1681 » Thu Feb 24, 2005 19:59

Ahhh... ::enlightenment:: Thanx alot guys! Works great now. :D BTW, great job so far Eddie. I can't wait to see the other great features you implement next.

User avatar
Legolas1681
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Jan 28, 2005 00:32

Re: Problems with the MultiColumnList Widget

Postby Legolas1681 » Mon Feb 28, 2005 02:56

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.

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

Re: Problems with the MultiColumnList Widget

Postby CrazyEddie » Mon Feb 28, 2005 09:45

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.

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

Re: Problems with the MultiColumnList Widget

Postby CrazyEddie » Mon Feb 28, 2005 10:48

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.

User avatar
Legolas1681
Not too shy to talk
Not too shy to talk
Posts: 24
Joined: Fri Jan 28, 2005 00:32

Re: Problems with the MultiColumnList Widget

Postby Legolas1681 » Tue Mar 01, 2005 02:25

Oh yeah! Fixed it right up perfectly! Amazing how modifying two lines of code can make such a difference. :D

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

Re: Problems with the MultiColumnList Widget

Postby CrazyEddie » Tue Mar 01, 2005 14:02

Cool. This fix has been put into CVS for both 0.2.0 and HEAD.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests