|
|
Home » U++ Library support » TreeCtrl » Anomaly in tree control
Anomaly in tree control [message #29781] |
Tue, 16 November 2010 11:38 |
gprentice
Messages: 260 Registered: November 2005 Location: New Zealand
|
Experienced Member |
|
|
I just noticed what seems to be a problem in the tree control. I was trying the tree control reference example and with the tree showing a directory I was testing to see whether the tree remembered the collapsed/ uncollapsed state of lower level nodes when the top level node was uncollapsed -> collapsed -> uncollapsed. I found the lower level plus/minus icon then showed as uncollapsed (minus) but the node wasn't actually expanded.
i.e.
start with tree all collapsed
use right arrow key to expand first level
use down arrow key to go to first child
use right arrow key to expand first child
use up arrow key to go back to root node
use left arrow key to collapse root node
use right arrow key to expand root node
now you should see the problem where the first child node has a minus icon but is uncollapsed. Sometimes the problem doesn't appear the first time.
Graeme
|
|
|
|
Re: Anomaly in tree control [message #29783 is a reply to message #29782] |
Tue, 16 November 2010 11:57 |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
I does appear to be a bug. The TreeCtrl uses a pool of nodes to reduce allocation times but doesn't reset Node::isopen on a new Insert. In this case that means that the node thinks it's open but iot doesn't have a sub-tree because the WhenOpen callback hasn't been triggered.
The additon of:
to TreeCtrl::Insert fixes the problem.
This example will still not be able to remember the openness of nest trees though. If you want dynamic sub-tree creation while remembering the opneness of sub-trees you'll have to remember fodler states yourself.
[Updated on: Tue, 16 November 2010 11:58] Report message to a moderator
|
|
|
Re: Anomaly in tree control [message #29784 is a reply to message #29782] |
Tue, 16 November 2010 12:00 |
gprentice
Messages: 260 Registered: November 2005 Location: New Zealand
|
Experienced Member |
|
|
Not sure.
close directory in the example is this
void CloseDir(int id) {
tree1.RemoveChildren(id);
}
I changed it to this but it didn't fix the problem
void CloseDir(int id) {
tree1.Close(id);
tree1.RemoveChildren(id);
}
so I guess the minus sign is showing there's no children.
I'm wondering if there should be no plus or minus icon on a node that has no children - but then for this example you wouldn't be able to re-populate the node so perhaps remove-children isn't quite the normal thing to do in CloseDir.
[Edit] - oops, didn't see your second answer before I posted this. Thanks.
[Updated on: Tue, 16 November 2010 12:02] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Thu Mar 28 19:27:29 CET 2024
Total time taken to generate the page: 0.01076 seconds
|
|
|