|
Infralution Support Support groups for Infralution products
|
View previous topic :: View next topic |
Author |
Message |
keesp Guest
|
Posted: Wed Jul 27, 2005 2:58 pm Post subject: Switching focus between editboxes in virtual tree |
|
|
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
|
Posted: Wed Jul 27, 2005 11:38 pm Post subject: |
|
|
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 |
|
|
keesp Guest
|
Posted: Thu Jul 28, 2005 8:37 am Post subject: Switching focus between editboxes in virtual tree |
|
|
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 |
|
|
|
|
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
|