windrobin / winforms-geplugin-control-library

Automatically exported from code.google.com/p/winforms-geplugin-control-library
GNU General Public License v3.0
0 stars 1 forks source link

KmlTreeView does not auto check sub nodes #13

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Check a root node
2. Notice child nodes don't auto check

What is the expected output? What do you see instead?
1. When checking a root object, I would think all sub nodes should also be 
checked / unchecked. If not, a user may have to check 10s or even 100s of 
boxes to get it all showing again.

What version of the product are you using? On what operating system?
Latest, Vista / XP

Please provide any additional information below.
Hey again!  :-D
I am having a problem with my application - users will be very frustrated 
if they have to click 10s / 100s boxes to get all placemarks back. I have 
tried checking them programmatically, but I keep getting a stack overflow 
exception due to CheckAllParentNodes() method. I tried this below, but 
obviously it doesn't help, because the features don't get turned on / 
off  :-)

this.AfterCheck -= new TreeViewEventHandler(KmlTree_AfterCheck);
foreach (TreeNode node in e.Node.Nodes)
{
    node.Checked = true;
}
this.AfterCheck += new TreeViewEventHandler(KmlTree_AfterCheck);

Any ideas?  :-)

Original issue reported on code.google.com by gordon_m...@hotmail.com on 12 Oct 2009 at 3:19

GoogleCodeExporter commented 9 years ago
Hi, This is by design to stop large numbers of nodes becoming visible at once. 
I will 
implement a property in the KmlTreeView that toggles a 'checkAllChildren' 
behaviour 
for parent nodes and default it to true. So there will be something like.

KmlTreeView.CheckAllChildNodes = true; //default
KmlTreeView.CheckAllChildNodes = false;

FYI you are getting a stackoverflow because the code you are using causes an 
infinite 
recursion. Setting the TreeNode.Checked property from within the AfterCheck 
event 
handler causes the event AfterCheck event to be fired, which checks the node 
which 
causes the AfterCheck event to be fired...Ad infinitum 

You should test if TreeViewAction.Unknown before setting node.Checked. i.e.

foreach (TreeNode node in e.Node.Nodes)
{
  if (e.Action != TreeViewAction.Unknown)
  {
    node.Checked = true;
  }
}

Anyhow, I will post a build in the next half hour :) thanks again!

Original comment by fraser.c...@gmail.com on 12 Oct 2009 at 5:47

GoogleCodeExporter commented 9 years ago
...hmmm some kind of tri-state check box indication would be nice too...

Original comment by fraser.c...@gmail.com on 12 Oct 2009 at 5:54

GoogleCodeExporter commented 9 years ago
Ok its is in the latest commit...

Original comment by fraser.c...@gmail.com on 12 Oct 2009 at 5:58

GoogleCodeExporter commented 9 years ago

Original comment by fraser.c...@gmail.com on 12 Oct 2009 at 6:08

GoogleCodeExporter commented 9 years ago
You are the man! This is going to be really useful.

Thanks!

Original comment by gordon_m...@hotmail.com on 12 Oct 2009 at 7:28