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 

Switching focus between editboxes in virtual tree

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





PostPosted: Wed Jul 27, 2005 2:58 pm    Post subject: Switching focus between editboxes in virtual tree Reply with quote

Hi,

I want to use the arrow keys to horizontally and vertically change focus on the editboxes that are visible in the virtual tree, so that they can be edited without having to use the mouse. Is there a way to achieve this?

Thanks,

Kees
Back to top
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jul 27, 2005 11:38 pm    Post subject: Reply with quote

You can do this - but you need think carefully about whether you should. If you are editing text then users may become very frustrated if the left/right arrows move to the next cell rather than allow caret movement within the editor. Other editors (particularly dates) make use of the up/down arrows to allow quick editing. The tab and shift-tab keys can always be used for keyboard navigation.

Anyway if despite this you wish to use the arrows for editor navigation here's what you do. Derive a class from VirtualTree and override the ProcessEditCmdKeys method as follows:

Code:
       
protected overrides bool ProcessEditCmdKeys(Keys keys)
{
      switch (keys)
      {
      case Keys.Up:
          return MoveFocusRow(-1, KeyboardSelectionMode.MoveSelection, true);
      case Keys.Down:
          return MoveFocusRow(1, KeyboardSelectionMode.MoveSelection, true);
      case Keys.Right:
          return EditNext();
      case Keys.Left:
          return EditPrior();
      }
      return base.ProcessEditCmdKeys(keys);
}

_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
keesp
Guest





PostPosted: Thu Jul 28, 2005 8:37 am    Post subject: Switching focus between editboxes in virtual tree Reply with quote

Thanks,

Works fine now! I had thought of using the tab, but as I was using the standard KeyDown event approach, it didn't seem to work. The approach you suggested gives ample control over the various keys and allows me to combine Tab and arrow keys, and even ESC as an undo works fine!

Thanks again,

Kees
Back to top
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