Root TreeItems will not expand

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Root TreeItems will not expand

Postby Van » Sat Feb 14, 2009 23:24

I have a CEGUI::Tree and I add several ROOT items. Then I add several branches to the ROOT items. My problem is, when a user selects a ROOT item, it will not expand and show the branches (children).

I have stepped through the code and I see the branch items being attached to the root items and I in debug I can see the items but I can't get the root item to expand when selected.

What am I missing?

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

Postby CrazyEddie » Mon Feb 16, 2009 09:58

Hi,

I think you have to manually click the "expand" icon/button?

Aside from this, I'm not sure. I do not have a great deal of experience of how this tree works, though I know it's not always "good"; while I agree that "any tree is better than no tree", I totally despise this tree implementation :)

CE.

User avatar
Van
Just can't stay away
Just can't stay away
Posts: 225
Joined: Fri Jan 21, 2005 20:29
Contact:

Postby Van » Mon Feb 16, 2009 13:16

Found it.

Apparently the widget will not function unless you have defined the TreeItemClose and TreeItemOpen icons because you have to click the "icon" to expand/collapse the tree. Clicking or DoubleClicking the item doesn't fire off the expand/collapse events.

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

Postby CrazyEddie » Mon Feb 16, 2009 20:21

Hi,

Thanks for posting the resolution to the issue, and I'm glad you found it.

I think expanding / collapsing parts of the tree in response to double-clicks is something that should probably be added, unless progress and time pans out such that I am able to provide a decent replacement ready for 0.7.0 :P

CE.

ScurvyKnave
Just popping in
Just popping in
Posts: 5
Joined: Wed May 20, 2009 03:50

Re: Root TreeItems will not expand

Postby ScurvyKnave » Mon Jun 08, 2009 04:06

Has this problem been resolved?

I have devoted a lot of time to getting my UI looking decent with CEGUI, only to find that the tree item (which is essential for me) does not work as one expects it to.

Ideally it would expand if you double-clicked anywhere on the tree item, not just the image. However, if I could make the image larger (as it is, to get the aiming right at very high resolutions takes some effort), this problem could at least be alleviated.

I've tried, but to no avail. But I'm not too great with the ".looknfeel" data (I usually just use TeharezLook data and just modify the tga image to get what I want). Is it possible to (a) enlarge the rendered image for the tree items and (b) enlarge the clickable area (I guess these may be the same thing)?

Any help would be appreciated. Thanks.

ScurvyKnave
Just popping in
Just popping in
Posts: 5
Joined: Wed May 20, 2009 03:50

Re: Root TreeItems will not expand

Postby ScurvyKnave » Mon Jun 08, 2009 04:33

Also, how do I control the horizontal offset of a child item relative to its parent? Currently the offset is quite large. Besides looking a bit odd, this makes my text length exceeds the width of the container. This forces me to either use a very wide container or put up with a horizontal scrollbar, which I would prefer to avoid.

User avatar
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

Re: Root TreeItems will not expand

Postby Mikademus » Thu Mar 18, 2010 22:45

I'm reviving this thread since it is closely relevant to my situation as well.

I have populated my tree, but it is not expanded by default. I can find no way to accomplish this (though methods or events). So basically, how do I make the tree to be fully expanded programatically?

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

Re: Root TreeItems will not expand

Postby CrazyEddie » Fri Mar 19, 2010 09:50

I found no easy way to do this. You might be able to do something by scanning down the items in the tree and toggling the 'open' state via TreeItem::toggleIsOpen, and then invalidating the window to have it redrawn,or something. Yes this sucks, my total revulsion for this tree is well known - it is truly a travesty of the highest order that this code ever got added to the code base, but alas once there it's more difficult to remove ;)

CE.

User avatar
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

Re: Root TreeItems will not expand

Postby Mikademus » Fri Mar 19, 2010 11:27

Lol, yeah, it is difficult to fail to notice your sentiments regarding this control. As for me, as much as I'd like a better implementation, atm I'm happy I have a tree control at all, since that was what made me throw out OGRE's default version and start using the trunk instead! Still, a decent tree would be lovely!

Anywho, yeah, iterating over the treeitems and calling toggleIsOpen() was the way to go. Thanks for directing me to the solution! Unfortunately toggleIsOpen() does not take parameters so the toggle is just a toggle with no manual means of setting the open/closed state of the branch... O.o Another enjoyable aspect was that you get a node's children by calling the getItemList() member, which is not very self-descriptively named and which returns a LBIitemList datatype, which is not covered in the docs. It turned out to be CEGUI::TreeItem::LBItemList, a typedef for a std::vector of TreeItem pointers.

But I've got the tree expanded at creation time now, and given that this answer's the OP's question, too, I think it is safe to mark this thread as [solved]?

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

Re: Root TreeItems will not expand

Postby CrazyEddie » Fri Mar 19, 2010 14:05

Mikademus wrote:Lol, yeah, it is difficult to fail to notice your sentiments regarding this control. As for me, as much as I'd like a better implementation, atm I'm happy I have a tree control at all, since that was what made me throw out OGRE's default version and start using the trunk instead! Still, a decent tree would be lovely!

Yeah, and we'll get there eventually too :) It's been ages since I wrote a widget :twisted:

Mikademus wrote:I think it is safe to mark this thread as [solved]?

Probably, though the OP has to do that ;)

CE.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 22 guests