ListboxItem outside the box

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

hermit purple
Just popping in
Just popping in
Posts: 13
Joined: Wed Oct 21, 2009 20:21

ListboxItem outside the box

Postby hermit purple » Wed Jan 13, 2010 15:46

I'm making a list of items using ItemListbox (the box) and ItemEntry (the items), but for some reason the items are overflow to outside the boundary of the box.

For example, if the box can fit 3 items and I added 5, then there will be 2 items showing up beneath the listbox. This is not just a graphical glitch either, as the box doesn't scroll, I can highlight the last 2 items outside the box. It's as if the box thinks it can fit all 5 items.

I tried to use sizeToContent() and the box will resize to fit all 5 items but that's not what I want. I need it to fit 3 items and scroll.

I use addItem and also addChildWindow to add the items to the listbox. Is there some function I'm forgeting? I'm using 0.7.0.

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

Re: ListboxItem outside the box

Postby CrazyEddie » Thu Jan 14, 2010 09:40

Hi,

I wonder, are you using one of the pre-defined skins that come with CEGUI or some other skin? Perhaps the named area in the skin, that ItemListbox uses for rendering into and clipping the items, is not defined or is defined incorrectly?

CE.

hermit purple
Just popping in
Just popping in
Posts: 13
Joined: Wed Oct 21, 2009 20:21

Re: ListboxItem outside the box

Postby hermit purple » Mon Jan 18, 2010 15:34

I'm using Taharez as the skin and FairChar as the pixmap font.

I think they are the same as they were in the package, except that FairChar was downloaded from the CEGUI website as it's not part of the library (there are no pixmap font in the library).

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

Re: ListboxItem outside the box

Postby CrazyEddie » Mon Jan 18, 2010 17:00

Hmmm. FairChar should be included with the library packages - which package are you using that does not contain this font?

I will retest this with the FairChar font...

CE.

hermit purple
Just popping in
Just popping in
Posts: 13
Joined: Wed Oct 21, 2009 20:21

Re: ListboxItem outside the box

Postby hermit purple » Mon Jan 18, 2010 17:42

You're right, FairChar is part of the 0.7.0 lib that I use. I tested it on the sample project and it actually work. This means the original lib actually works fine. So the problem is only happening on my phyre ported version of the lib.

My question is then, where is the code that determines which item gets rendered, and if the list should scroll down. Because the problem I'm having is that not only the whole list is showing, it also doesn't scroll and you can highlight items outside the box.

For reference, the phyre engine port of the library is mostly identical to the original. The renderer module is the part that's new and I also comment out dynamic module and implement my own timer. But I don't think these changes should effect the listbox.

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

Re: ListboxItem outside the box

Postby CrazyEddie » Mon Jan 18, 2010 18:34

Ok.

The code that decides the area available to render into is line 57 of cegui/src/WindowRendererSets/Falagard/FalItemListbox.cpp. If this returns something really, badly wrong, then you might see the issue you're getting - this could happen, for example, if the renderer / render target are returning bad info as regards to the size of the display / target.

The code that decides about clipping, hit-testing of items and such is the regular code used for the rest of the system; for a scrolled list, such as ItemListbox, the content is added to a content pane window that is positioned appropriately so that the correct content is visible in the area determined above - there is no special case code used for this.

HTH

CE.

hermit purple
Just popping in
Just popping in
Posts: 13
Joined: Wed Oct 21, 2009 20:21

Re: ListboxItem outside the box

Postby hermit purple » Mon Jan 18, 2010 22:26

The area return, basically the d_innerUnclippedRect of the listbox is way too high. I tried to make the box smaller in the editor and the area in code will be smaller but only by a very small margin.

Before, top is 499 and bot is 969. After making the box 1/3 of it's original height, the top remains at 499 and bot becomes 643, which is only a small change.

I've check that ViewportTarget's area and Renderer's d_displaySize are both the screen size. I test with other values and it doesn't effect the items outside the box at all.

How is the dimension calculated? I got very confused falagard xml handler...

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

Re: ListboxItem outside the box

Postby CrazyEddie » Tue Jan 19, 2010 10:00

The position and size of this area comes from a set of named areas defined in the looknfeel. Taking the basic, no scrollbars, one as an example, we have:

Code: Select all

        <NamedArea name="ItemRenderArea">
            <Area>
                <Dim type="LeftEdge" ><ImageDim imageset="TaharezLook" image="ListboxLeft" dimension="Width" /></Dim>
                <Dim type="TopEdge" ><ImageDim imageset="TaharezLook" image="ListboxTop" dimension="Height" /></Dim>
                <Dim type="RightEdge" >
                    <UnifiedDim scale="1" type="RightEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="ListboxRight" dimension="Width" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
                <Dim type="BottomEdge" >
                    <UnifiedDim scale="1" type="BottomEdge">
                        <DimOperator op="Subtract">
                            <ImageDim imageset="TaharezLook" image="ListboxBottom" dimension="Height" />
                        </DimOperator>
                    </UnifiedDim>
                </Dim>
            </Area>
        </NamedArea>


This is describing the area as being the size of the containing window minus the size of the images used for the frame. Here it seems the BottomEdge (and RightEdge?) part(s) is (are) incorrect. All these are saying is a scale value of '1' - which basically says take the height (or width) of the containing element (in this case the ItemListbox window). Then we just subtract the height (or width) of the image used for those edges of the frame.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 3 guests