Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
255
Double click event for node collapsing .....
posted

Hi ,  

I have UltraWinTree with several nodes . On single clicking a node say "first node" , the Subsequent childnodes should open and on double clicking "first node" node again , the nodes should collapes .

So , i used three events and 1 integer to handle this issue . The below code is working fine for the single click to expand the nodes, but when i double click the parentnode to collapse its childnodes continously then for the third or fourth time the nodes collapsing happening for the single click . please help me solve this issue ....

Integer: 

int UTAttributesCollapseFlag  = 0 ;

Events : 

1) private void UTAttributes_AfterCollapse(object sender, NodeEventArgs e)

{

         UTAttributesCollapseFlag = 1;

}

2) private void UTAttributes_MouseDoubleClick(object sender, MouseEventArgs e)

{

Point currentPoint = new Point(e.X, e.Y);

UltraTreeNode node = UTAttributes.GetNodeFromPoint(currentPoint);

if (node != null)

{

if (UTAttributesCollapseFlag == 1)

{

node.CollapseAll();

UTAttributesCollapseFlag = 0;

}

 

 

 

}

}

3)private void UTAttributes_MouseClick(object sender, MouseEventArgs e)

{

Point currentPoint = new Point(e.X, e.Y);

UltraTreeNode node = UTAttributes.GetNodeFromPoint(currentPoint);

if (node != null)

{

if (node.Expanded == false)

{

if (UTAttributesCollapseFlag == 0 )

{

node.ExpandAll();

}

UTAttributesCollapseFlag = 0;

}

}

}