Some questions and troubles with List...

Artic_Ice83

10-02-2008 13:52:19

Hi! i was playing around with a list and i noted that there are some strange behaviours in some conditions.
First of all, if i create a list through a panel and add, for example, 15 items in the list and set the list allowScrolling(true), the list behaviour is correct.
but if i don't allow the scrolling of the list but change its height, comes a strange behaviour...here is the code that reproduce it.


QuickGUI::Panel *mPanel;

mPanel = mSheet->createPanel();
mPanel->setDimensions(QuickGUI::Rect(500,50,300,200));
mPanel->allowScrolling(true);

QuickGUI::List *mList;

mList = mPanel->createList();
mList->setHeight(400);

for(int i=0;i<15;++i)
{
mList->addTextBox()->setText(Ogre::StringConverter::toString(i));
}


First, scrolling the panel up i have noted that the text of the list don't clip with the up border of the panel.
Second, always scrolling the panel, you can note that seems there's also another "clipping border" that doens't belong to the panel(the parent).
I tried to change the clip mode but nothing solve the "problem"...i don't know if change the QuadContainer to the parent container can modify something...or if this is correct...

kungfoomasta

11-02-2008 04:28:03

Hey Artic, I loaded up your code and see the issue also. To think I was done with clipping.. :cry:

I looked into it a lot this morning, and couldn't really track down the cause. I'll have to look into it in the coming week. Any suggestions for a clipping system that works are welcome. :)

Artic_Ice83

11-02-2008 16:10:30

after this try with the list, i try to simulate the list with two panels: panel 1 that create the panel 2, and this panel 2 creates some textboxes, similar to the list widget. the result is the same behaviour of the list, but if i set the clipmode of the textboxes to CLIPMODE_PARENT_CONTAINER the textboxes don't clip with the panel2, but clips with the panel1. The text, instead, seems don't clip correctly with the top border...
here is the second branch of code:



QuickGUI::Panel *panel1;

panel1 = mSheet->createPanel("panel1");
panel1->setDimensions(QuickGUI::Rect(50,50,400,200));
panel1->allowScrolling(true);
panel1->setClipMode(QuickGUI::Quad::CLIPMODE_PARENT_CONTAINER,true);

QuickGUI::Panel *panel2;

panel2 = panel1->createPanel("panel2");
panel2->setDimensions(QuickGUI::Rect(10,10,300,400));
//panel2->setInheritQuadLayer(true);
//panel2->setClipMode(QuickGUI::Quad::CLIPMODE_PARENT_CONTAINER,true);


QuickGUI::TextBox *tempTB;

for(int i = 0; i<15; ++i)
{
tempTB = panel2->createTextBox(Ogre::StringConverter::toString(i));
tempTB->setText(Ogre::StringConverter::toString(i));
tempTB->setPosition(20,i*30+10);
tempTB->setInheritQuadLayer(true);
tempTB->setClipMode(QuickGUI::Quad::CLIPMODE_PARENT_CONTAINER,true);
}


Theoretically the clipping system should works with the actual implementation...

kungfoomasta

11-02-2008 17:50:00

I'm going to think about this, I'll try to fix this as soon as I can, I was hoping to release soon. Logically it should work.

CLIPMODE_NONE - Lists when used as Menus should not be clipped at all.
CLIPMODE_OWNER - Text should be clipped to its Widget's bounds.
CLIPMODE_PARENT - Texture Quads
CLIPMODE_GRANDPARENT - Borders.

Artic_Ice83

11-02-2008 19:36:41

well, i have some question also with the clipping mode.
for example, i have a widget that is composed by borders, a texture and the text. Have all the components their own clip mode?

kungfoomasta

11-02-2008 20:05:36

Now that I think about it, I should remove Widget::set/getClipMode, because ClipMode is not at the Widget level, but at the Quad level. Think of ClipMode in terms of the Quad. The "Owner" is the Widget which created the Quad. "Parent" refers to the ParentWidget of the Owner.

For Borders, they are component widgets. Using a Window with Borders as an example, the Borders lie outside Window Dimensions and should not be clipped by the Window (Parent) dimensions. Instead, the Borders should be clipped by the Window's parent, which is why I needed to create the CLIPMODE_GRANDPARENT type.

The types I listed are not accurate with the current implementation, right now I have CLIPMODE_CONTAINER. I don't think I need to clip to containers, parent and grandparent should be more accurate.

Artic_Ice83

11-02-2008 20:34:02

ok, now i've understood. i think too that the parent-grandparent clipping system is both more accurate, intuitive and maybe take trace in some ways of relationship between widgets.

kungfoomasta

24-02-2008 18:55:58

Ok, I think I have made some good progress on Clipping. At least, your simple example works correctly, and everything looks ok. :)

Artic_Ice83

25-02-2008 08:19:16

ok! good job kungfoomasta!!!! :D you are the best!