View previous topic :: View next topic |
Author |
Message |
vanslyck
Joined: 25 Jan 2012 Posts: 3
|
Posted: Wed Jan 25, 2012 8:55 pm Post subject: Display Cell Editor When Row is Selected |
|
|
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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Wed Jan 25, 2012 11:50 pm Post subject: |
|
|
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 |
|
|
vanslyck
Joined: 25 Jan 2012 Posts: 3
|
Posted: Thu Jan 26, 2012 2:14 pm Post subject: |
|
|
Yes, that's what I am trying to say. 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 |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Jan 26, 2012 10:55 pm Post subject: |
|
|
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 |
|
|
vanslyck
Joined: 25 Jan 2012 Posts: 3
|
Posted: Fri Jan 27, 2012 2:46 pm Post subject: |
|
|
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 |
|
|
|