TreeItems not updating (0.7.1)

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
Mikademus
CEGUI MVP
CEGUI MVP
Posts: 130
Joined: Wed Mar 18, 2009 19:14

TreeItems not updating (0.7.1)

Postby Mikademus » Fri Mar 19, 2010 20:48

Hi. Yeah, this is a question about the much abhorred Tree widget. Unfortunately, I have gone from pain to suffering and am starting to join in on the lamentations about this particular control... Anyway, it is what I've got atm, and what I have to work with or around.

Ok, so I have my tree, populated and expanded. Since it is anything other than trivial to determine if a TreeItem was clicked (TreeItem doesn't extend Window!) I had to obtain the TreeItem corresponding to a node in my container, and then update the text and colours of that TreeItem manually. However, even though I have the correct item, the Tree itself will not display the changes. If the Tree will not update, or if the TreeItems reject changes, or whatever I don't know. Tree::handleUpdatedItemData() made no difference, and Tree::ensureItemIsVisible() likewise is ineffective. However, toggling TreeItems will fold up or expand them, so the Tree is not utterly non-responsive.

Anyone have any idea whatsoever what could be reason for TreeItems not to be updated?

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Sat Mar 20, 2010 08:23

Mikademus wrote:Hi. Yeah, this is a question about the much abhorred Tree widget. Unfortunately, I have gone from pain to suffering and am starting to join in on the lamentations about this particular control...

It gets everyone in the end ;)

For the issue, it might be an issue of the caches not getting invalidated. Did you try calling Window::invalidate() for the Tree?

CE.

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Sat Mar 20, 2010 09:18

CrazyEddie wrote:It gets everyone in the end ;)

In the end? It took me half a day...

Did you try calling Window::invalidate() for the Tree?

Yes. Tree::invalidate(), Tree::handleUpdatedItemData(), threats and ritual dancing and chanting. The dancing did nothing, but helped blow off some frustrated energy, so it was the best approach so far.

I experimented around some more, and it seems that when I change a TreeItem the object's data is changed even though the tree is not updated. Any changes I make before adding it to the tree will be shown. But the tree will apparently only display what was in the item when it was added. Perhaps this is my design (or rather, by lack of design), that trees are static after creation? But then why does it have members like endureItemIsVisible(), which also are ineffective?

I guess two possible "solutions" could be to remove the TreeItem to update from the tree and add an updated one, or clear the tree and rebuild it for every update. O.o

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Sat Mar 20, 2010 10:06

Update because I tried the two "solutions". First I gotta say: fantastic. Whoever designed this control should seriously read up on usability and software architecture. It is deviously designed: at every turn you take to work around the limitations of the control there is an obstacle placed to thwart you...

Anyway, first, what I need to do is mark a "the current" item as special (selected, active, whatever). Users typically go to the next or previous item in depth-first leaf-only fashion.

Resetting and rebuilding the tree obviously work for forcing updates. But this is tremendously slow - it takes about a second for tree of merely 90 nodes, which makes it a non-viable approach.

Deleting the TreeItem and replacing it might work, but since there is no way to obtain the parent TreeItem of a child TreeItem the algorithmic complexity of rolling this solution yourself given the lack of facilities and actual counter-usable design of the widget becomes prohibitive (in short: recursions, iterations of lists, and resolution of depth/breadth-first rules with manual book-keeping of parent and sibling relationships).

Shit, I think I might need mental therapy after this...

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Sun Mar 21, 2010 06:53

This Tree was not designed, surely nobody could be so evil :lol: In all seriousness, the Tree appears to have been a collection of naive hacks upon the original Listbox - at one stage there were issues caused by incorrect casts to CEGUI::Listbox* within the Tree code itself. I do not necessarily blame the person who wrote this code - as coders sometimes we a have all resorted to nasty hacks to get something working - however, I do completely hold responsible the person who added this code to the CEGUI code base, that is totally unforgivable.

Aside from all the design issues, I think the lack of updates when content changes can be considered a bug. I will look into this, though it may not be for a couple of days or so.

CE.

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Sun Mar 21, 2010 09:21

CrazyEddie wrote:I think the lack of updates when content changes can be considered a bug. I will look into this, though it may not be for a couple of days or so.


That is greatly appreciated! Thanks, Eddie!

Edit: Regarding "This Tree was not designed, surely nobody could be so evil ", I would like to get a bit philosophical for a second. Sometimes things are designed, that is, planned. Some things evolve. Then there are things that just happen. Like boils, accidents and catastrophes. These happenstances generally create great destruction and misery. They often bring out the worst in man, but also the best: our hope! So great traumas and disasters sometimes are also the engine for change and improvement. May this crock of rancid sewage be the fertiliser the makes beautiful trees bloom!

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Mon Mar 22, 2010 07:00

Mikademus wrote:May this crock of rancid sewage be the fertiliser the makes beautiful trees bloom!

Awesome! :hammer:

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Thu Mar 25, 2010 11:39

To update: this issue should now be fixed in branches/v0-6 @ r2486.

HTH

CE.

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Fri Mar 26, 2010 11:58

Confirmed with the trunk version:

WORKING: TreeItem::setText() and TreeItem::setTextColours()
Not working: TreeItem::setSelected()
Not working: Tree::ensureItemIsVisible()

Nonetheless, the setText and setTextColours fixes was what I needed atm, so thanks and cheers! I appreciate it! :)

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Fri Mar 26, 2010 12:20

Hmm. I wasn't aware I was supposed to be looking at those other functions :lol: I'll have a look at those and report back when it's done (tomorrow, most likely).

Also, when you say 'trunk' do you actually mean 'branches/v0-7'? Because changes don't get merged from the stable branch into trunk until Sundays (usually).

CE.

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Fri Mar 26, 2010 14:06

CrazyEddie wrote:when you say 'trunk' do you actually mean 'branches/v0-7'? Because changes don't get merged from the stable branch into trunk until Sundays (usually).


Yeah, probably - I was basically just faking terminology to sound like a version control pro! :mrgreen: I grabbed the latest version of 0.7 (r2487 iirc) and compiled, so perhaps "latest head" is more correct?

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Fri Mar 26, 2010 19:04

well..... ;)

I know what you mean, and you know what you mean, perhaps this is all that matters? :hammer:

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Fri Mar 26, 2010 20:21

Well, at my day work we--just like mutated cows--had problems with multiple heads, so "latest head" didn't sound too unreasonable to me...

let's use the beer emoticon! ---> :pint: Cheers!

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

Re: TreeItems not updating (0.7.1)

Postby CrazyEddie » Sat Mar 27, 2010 15:58

I have tested these other issues you mentioned...
Not working: TreeItem::setSelected()

I found no issues here. Ensure you have set a selection brush image (for each item) and called Tree::handleUpdatedItemData when you change the item select state.

Not working: Tree::ensureItemIsVisible()

This was unimplemented and left as a TODO by the elite coder who decided it was a good idea to put this tree into CEGUI in the first place. I have fixed this and it should be working in branches/v0-7 at r2494 (along with a bunch of earlier stuff from today - happy recompiling :lol:).

As an aside, I notice what I consider to be various rendering glitches, though I don't have the motivation to fix them. Working on this component makes my blood boil :rofl:

CE.

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

Re: TreeItems not updating (0.7.1)

Postby Mikademus » Sun Mar 28, 2010 20:35

CrazyEddie wrote:I have tested these other issues you mentioned...
Not working: TreeItem::setSelected()

I found no issues here. Ensure you have set a selection brush image (for each item) and called Tree::handleUpdatedItemData when you change the item select state.

Noted and will be tested in next run. There are also other strange prerequisites in this control, such as that expanding and folding subtrees only work if you have loaded icons etc. Not a very pretty control to understand much less use...

Not working: Tree::ensureItemIsVisible()

This was unimplemented and left as a TODO by the elite coder who decided it was a good idea to put this tree into CEGUI in the first place. I have fixed this and it should be working in branches/v0-7 at r2494 (along with a bunch of earlier stuff from today - happy recompiling :lol:).

Confirmed, now working as it should. Thanks again bro! I really appreciate it! Well, not the recompiling part so much, but you get what I mean :)


Return to “Help”

Who is online

Users browsing this forum: No registered users and 6 guests