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 

Switch column through arrow key in row seletion mode

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



Joined: 07 Nov 2007
Posts: 24

PostPosted: Mon Dec 20, 2010 2:03 am    Post subject: Switch column through arrow key in row seletion mode Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Dec 20, 2010 10:55 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
mutouaa



Joined: 07 Nov 2007
Posts: 24

PostPosted: Mon Dec 20, 2010 3:13 pm    Post subject: Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Mon Dec 20, 2010 10:19 pm    Post subject: Reply with quote

In that case why not use the SelectionMode.Cell option?
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
mutouaa



Joined: 07 Nov 2007
Posts: 24

PostPosted: Tue Dec 21, 2010 5:47 am    Post subject: Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Tue Dec 21, 2010 10:12 pm    Post subject: Reply with quote

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
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