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 

Display Cell Editor When Row is Selected

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



Joined: 25 Jan 2012
Posts: 3

PostPosted: Wed Jan 25, 2012 8:55 pm    Post subject: Display Cell Editor When Row is Selected Reply with quote

I am using a UniversalEditBox in column of my tree and would like to only display the editor when the row is selected instead of requiring that the user click in the cell to activate the editor.

I have the editor's DisplayMode = DisplayMode.OnEdit but I can't figure out how to show the editor in the tree's SelectionChanged event.

Is this possible?
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jan 25, 2012 11:50 pm    Post subject: Reply with quote

If you have the VirtualTree.SelectBeforeEdit property set to false then if the use selects the row by clicking on a cell then the editor is displayed. The Data Set Browser sample project demonstrates this behaviour

Or do you mean that you want to be able to display the editor when the use selects the row by clicking outside of the cell as well (say by clicking on the Row Header or non-editable cell)?
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
vanslyck



Joined: 25 Jan 2012
Posts: 3

PostPosted: Thu Jan 26, 2012 2:14 pm    Post subject: Reply with quote

Yes, that's what I am trying to say. Smile I would like the cell editor to be displayed when the user selects any cell in the row, including non-editable cells.

Basically whenever the row is highlighted/selected (it is a single select tree), I would like the editor in this cell to be displayed.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Jan 26, 2012 10:55 pm    Post subject: Reply with quote

You can do that by handling the FocusRowChanged event and then calling EditFirstCellInFocusRow eg

Code:
      private void _virtualTree_FocusRowChanged(object sender, EventArgs e)
        {
            if (_virtualTree.EditWidget == null)
            {
                _virtualTree.EditFirstCellInFocusRow();
            }
        }


The check for the EditWidget ensures that you don't change the editor if the user does click on another cell that is editable.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
vanslyck



Joined: 25 Jan 2012
Posts: 3

PostPosted: Fri Jan 27, 2012 2:46 pm    Post subject: Reply with quote

Thank you! I appreciate your patience in helping me clarify what I was trying to accomplish.

At one point I had tried using SelectionChanged and also wasn't checking the EditWidget, so it was acting very weird. The code you sent works perfectly.
Back to top
View user's profile Send private message
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