Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

About the SelectRow Collapse problem.

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
cpbird



Joined: 29 Mar 2011
Posts: 4

PostPosted: Tue Mar 29, 2011 8:44 am    Post subject: About the SelectRow Collapse problem. Reply with quote

treProjectList.SelectedRow.ParentRow.Collapse();

When run the function in tree double click Event, the current row's ParentRow can collapse,but the current row's ParentRow next row is Expanded. Why is this? And How to avoid the next row expanded.

Please help me, thanks
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Mar 29, 2011 11:22 pm    Post subject: Reply with quote

I'm not quite sure what you mean. I've just modified the simple tree sample project and added a button to collapse the parent row of the selected row with the following code:

Code:
private void button1_Click(object sender, EventArgs e)
{
    Row parent = _virtualTree.SelectedRow.ParentRow;
    parent.Collapse();
}


This works exactly as I expected; the parent row is collapsed and I don't see any other row expanded. Perhaps if you can replicate the issue you are having in one of the sample projects and email the zipped project to support@infralution.com we could pin down the problem.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
cpbird



Joined: 29 Mar 2011
Posts: 4

PostPosted: Wed Mar 30, 2011 3:49 am    Post subject: Reply with quote

I mean that,When double click the tree,the current row' parent row should be Collapsed.
private void tree_DoubleClick(object sender, EventArgs e)
{
if (tree.SelectedItem != null)
{
DataRow dataRow = (DataRow)tree.SelectedItem;
if (dataRow != null)
{
if (dataRow is DSProjectCompare.PhaseRow )
{
AddSelectedProjectRow();
}
if (dataRow is DSProjectCompare.OptionRow)
{
tree.SelectedRow.ParentRow.Collapse();
}
}
}

}

Following the code, the tree have two Level 'Phase','Option',They have Parent-Children ralation.When user double-click the level 'Option'(children),the tree need Collapse the current row's parent row(Collapse the current level 'Option' 's parent level 'Phase').
My problem is double-click a 'Option',the parent 'Phase' can Collapse,but the next 'Phase' expanded or Collapse too.

Thank your help.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Mar 30, 2011 4:23 am    Post subject: Reply with quote

Collapsing the parent row in the double click event is a very unusual thing to do - since the default action for most tree controls on double click is to toggle the expansion state of the current node (which is what VirtualTree does by default if ExpandOnDoubleClick is true). So your users will be probably be surprised by this behaviour.

Anyway I added the following code to the double click handler

Code:
private void _virtualTree_DoubleClick(object sender, EventArgs e)
{
    Row selectedRow = _virtualTree.SelectedRow;
    if (selectedRow != null && selectedRow.ParentRow != null)
    {
        selectedRow.ParentRow.Collapse();
    }
}


Again this worked even if ExpandOnDoubleClick was true. So I think something else is going on in your case. Probably the only way to get to the bottom of the issue is if you can replicate it in a sample projects that you can send to us - so that we know for sure what behaviour you are seeing.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

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


Powered by phpBB © 2001, 2005 phpBB Group