I'm having a problem with the TreeViewAdv control (Essential Suite 18.104.22.168), but I suppose it's just my fault: in my application, a treeview should allow the child nodes to be filled on demand when the user clicks the [+] to expand the node. Here's a sample dummy code: I create a windows forms project and:
1) I insert a treeview (named _tree) into a form and set its LoadOnDemand=True, FullRowSelect=True; all the other properties are left unchanged to their defaults.
2) I add a handler for BeforeExpand and implement it as follows:
if ((e.Node.ExpandedOnce) || (e.Node.Parent != _tree.Root)) return;
for (int i=1; i<=3; i++) e.Node.Nodes.Add(new TreeNodeAdv(i.ToString()));
(=just add 3 children to the expanding node).
3) I add a button which when clicked does the following:
for (int i=0; i<10; i++)
_tree.Nodes.Add(new TreeNodeAdv(new string((char)(i+65),1)));
(=clear the tree and then add 10 nodes to the root node, with the text "A", "B"... and so on).
Now, when I click the 1st time the button, the tree is filled; then I expand any node, and the BeforeExpand handler is called and appends 3 children as expected. BUT when I click it again, the tree is cleared and nothing is shown; if I click it again, I get this exception:
"An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: '0' is not a valid value for 'value'. 'value' should be between 'minimum' and 'maximum'."
at the line: _tree.Nodes.Add(new TreeNodeAdv(new string((char)(i+65),1)));
What I'm doing wrong in clearing and then refilling the tree? How the fill-on-demand feature is supposed to be correctly used?
ASArun Srinivasan Syncfusion Team October 28, 2003 03:17 PM
Your code seems to be fine. Can you upload a sample so that we can take a look at what could be causing this?
DFDaniele FusiOctober 29, 2003 07:20 AM
> Your code seems to be fine. Can you upload a sample so that we can take a look at what could be causing this?
Here it is the dummy test project. Thanks in advance!
ASArun Srinivasan Syncfusion Team October 29, 2003 08:40 AM
There is an issue with Clear() being called when the scrollbar is visible in the TreeViewAdv control.
The Essential Tools team is looking into this issue and we apologize the inconvenience this has caused.
DFDaniele FusiOctober 29, 2003 10:59 AM
Many thanks for your reply; could you please tell me how can I be notified of the fix? Should I just check this forum?