Welcome Guest Search | Active Topics | Members | Log In | Register

FindNode and other issues on TreeListView v2.0.619 --> v2.2.0.0 Options
cserl
Posted: Friday, January 08, 2010 5:16:45 PM
Rank: Member

Joined: 12/13/2008
Posts: 12
Points: -64
Hi,

I have created a small code sample in Visual Studio 2005 which used to work with v2.0.619 but not more with 2.2.0.0. I have figured around 1 day to track this down, I hope it helps you to make this superb product even better.

1. enter the form design and add a treelistview to the form with 3 columns. Enter these nodes to Column 1:
parent node: abcdefg01.hij
child node: Node 11
child node: Node 111

2. Add a button to the form

3. Run it with v2.0.619 and observe that the findNode(..) calls are working correctly

4. Build it with v2.2.0.0. Findnode still works correctly for the node added by the designer. But the last findNode call returns null on the programmatically added node.
Even more interesting, after the 1st run the node added by the designer cannot be expanded any more. Furthermore the node just added programmatically will not be displayed. Now we enlarge the size of Column1 a bit, and the programmatically added node appears. Now the node added by the designer can be expanded.
Now Click the button a 2nd time without stopping the debug session. The first findnode in the click handler only now returns a correct value. If we hadn't resized the column and performed a 2nd click, so the 1st FindNode in the click handler would have returned here too the wrong result: null.

Code:

namespace TestBugFindNodeInv2_2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        TreeListViewNode C(int curBoxNr, LidorSystems.IntegralUI.Lists.TreeListViewNode parentNode)
        {
            TreeListViewNode Var1 = new LidorSystems.IntegralUI.Lists.TreeListViewNode(curBoxNr.ToString(), 7, 7);
            parentNode.Nodes.Add(Var1);
            return (Var1);
        }

        private void A(string cfName, string cfType, TreeListViewNode parentNode)
        {
            TreeListViewNode Var2 = new TreeListViewNode(cfName, 8, 8);
            parentNode.Nodes.Add(Var2);
        }

        TreeListViewNode B(string outfilefullname)
        {
            TreeListViewNode Var3 = new LidorSystems.IntegralUI.Lists.TreeListViewNode(outfilefullname, 6, 6);

            Var3.CheckBoxVisible = false;
            return (Var3);

        }

        private void button1_Click(object sender, EventArgs e)
        {
         
            TreeListViewNode foundVNodea = treeListView1.FindNode("abcdefg02.hij", false, 0);


           
            LidorSystems.IntegralUI.Lists.TreeListViewNode rootTriStateNodeInPreviewTree = null;
            LidorSystems.IntegralUI.Lists.TreeListViewNode parentNodeOfC= null;

            treeListView1.SuspendLayout();

            TreeListViewNode result = treeListView1.FindNode("abcdefg01.hij", false, 0);

            rootTriStateNodeInPreviewTree = B("abcdefg02.hij");

            parentNodeOfC= C(1, rootTriStateNodeInPreviewTree);
            A("0001", ".wvw", parentNodeOfC);
            treeListView1.Nodes.Add(rootTriStateNodeInPreviewTree);

            treeListView1.ResumeLayout();

            TreeListViewNode foundVNode = treeListView1.FindNode("abcdefg02.hij", false, 0);
        }
    }
}
LidorSystems Support
Posted: Friday, January 08, 2010 6:01:27 PM

Rank: Administration

Joined: 6/10/2005
Posts: 637
Points: 1,365
The control layout needs to be updated. Use the UpdateLayout or SuspendUpdate/ResumeUpdate methods.

We notice in your code that you use SuspendLayout/ResumeLayout methods. These methods are only inherited from the Control class, they don;t influence the actual control layout update. Instead use the SuspendUpdate/ResumeUpdate methods.

Users browsing this topic
Guest


Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Main Forum RSS : RSS

Powered by Yet Another Forum.net version 1.9.0 (NET v2.0) - 10/10/2006
Copyright © 2003-2006 Yet Another Forum.net. All rights reserved.
This page was generated in 0.065 seconds.