View previous topic :: View next topic |
Author |
Message |
mutouaa
Joined: 07 Nov 2007 Posts: 24
|
Posted: Mon Dec 20, 2010 2:03 am Post subject: Switch column through arrow key in row seletion mode |
|
|
Hi Infralution Gruop,
As you know the virtual tree default behaviour is to expand/collapse tree rows when pressing right/left arrow key in row selection mode. if current selection is the last level and press right arrow key, the scroll bar doesn't work.
My client has a new request: it is preferred that tree can switch column by pressing right/left arrow key in row selection mode. The behavior is with a whole row marked but selected column unmarked, while pressing <- and ->, the unmarked column switches.
I want to ask if this is possible to be implemented in virtual tree. if yes how to do that? thank you in advance! |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Dec 20, 2010 10:55 am Post subject: |
|
|
I assume that you mean you want to change the active editor with the arrow keys. Normally this is done with the tab or shit-tab keys. The reason for not using the arrow keys is that for many editors (eg text editors) the user needs to be able to use the arrow keys for navigating within the text editor. If Virtual Tree uses these keys for navigating between editors then this wouldn't be possible.
It would be possible (but not recommended) to to do what you want by overriding ProcessEditLeftCmdKey with a method that does the following:
Code: | if (!CompleteEdit()) return true;
KeyboardNavigationInUse = true;
return EditPrior(currentCell); |
and overriding ProcessEditRightCmdKey with a similar method that calls EditNext. _________________ Infralution Support |
|
Back to top |
|
|
mutouaa
Joined: 07 Nov 2007 Posts: 24
|
Posted: Mon Dec 20, 2010 3:13 pm Post subject: |
|
|
thank you for your quick reply.
actually I don't really have an editor, I just want to have a cell unmarked when the whole row is marked (normally blue in windows). when I press left/right arrow key, the unmarked cell switches within the selected row. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Dec 20, 2010 10:19 pm Post subject: |
|
|
In that case why not use the SelectionMode.Cell option? _________________ Infralution Support |
|
Back to top |
|
|
mutouaa
Joined: 07 Nov 2007 Posts: 24
|
Posted: Tue Dec 21, 2010 5:47 am Post subject: |
|
|
in the application we are using a row selection mode, but the client saw the DevExpress tree has the row selection mode with cell unmarked feature and they want it. so I have to come here ask for help. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Tue Dec 21, 2010 10:12 pm Post subject: |
|
|
It sounds like what you need is to use Cell selection mode - but just with a different appearance. Virtual Tree doesn't support this directly - but with a bit of work you could probably achieve it. You would need to create a custom CellWidget and RowWidget and override the GetActiveStyle methods. Below is the standard code from this method for the CellWidget:
Code: | public virtual Style GetActiveStyle()
{
bool showSelected = false;
switch (Tree.SelectionMode)
{
case SelectionMode.FullRow:
showSelected = Row.Selected;
break;
case SelectionMode.Cell:
Column selectedColumn = Tree.SelectedColumn;
showSelected = Row.Selected && (selectedColumn == null || selectedColumn == this.Column);
break;
case SelectionMode.MainCellText:
showSelected = Row.Selected && (Column == RowWidget.MainColumn);
break;
}
return (showSelected) ? GetSelectedStyle() : GetUnselectedStyle();
} |
As you can see in Cell SelectionMode normally the SelectedStyle is only used for a Cell when both the column and Row are selected. In your case you want the selected style to be used when the Row is selected BUT not the column ie
Code: | showSelected = Row.Selected && (selectedColumn != this.Column); |
_________________ Infralution Support |
|
Back to top |
|
|
|