This is a migrated thread and some comments may be shown as answers.

Handling left/right arrow keys when editing cell

4 Answers 46 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Randy
Top achievements
Rank 1
Randy asked on 18 Apr 2011, 08:32 PM
I've setup a custom cell editor using GridViewMaskedTextBoxColumn and was wondering if there was a way to handle the left and right arrow keys to tell the grid to commit the cell changes, move the cursor to the left or to the right (depending on what key was used), and then put the next cell into edit mode?

I now that the up and down arrow keys are handled automatically by the grid and work like I need it to.  I'm trying to get the same behavior with the left and right arrow keys.

I also have a custom keyboard provider and I see that the up/down arrows keys are handled there but I don't see the left/right arrow keys being passed to the keyboard provider.

Any suggestions on how to accomplish this?

Thanks,
Randy

4 Answers, 1 is accepted

Sort by
0
Accepted
Maya
Telerik team
answered on 19 Apr 2011, 02:34 PM
Hello Randy,

The reason for the behavior you experience is that the RadMaskedTextBox handles the left/right key events. What you may try to do is to add a handler for the grid and perform the moving to next/previous cell on your own. I am sending you a sample project illustrating a possible approach for this scenario.
Let me know whether is corresponds to your requirements.
 

Best wishes,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Randy
Top achievements
Rank 1
answered on 19 Apr 2011, 03:52 PM
Thanks Maya!  Your example was what I was looking for and I can adapt it for my project.
0
Randy
Top achievements
Rank 1
answered on 19 Apr 2011, 04:00 PM
Maya - one question on the sample application.  For the right arrow key, you are using the dispatcher to invoke the actions while you did not use the dispatcher for the left arrow key.  Is there a reason why?

Thanks
0
Maya
Telerik team
answered on 22 Apr 2011, 01:00 PM
Hi Randy,

Generally, this is just illustrating a possible solution that might be useful depending on the editing element. Still, you may implement the code as it is in the HandleKeyLeft(e) method - without invoking a dispatcher.
 

Regards,
Maya
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
GridView
Asked by
Randy
Top achievements
Rank 1
Answers by
Maya
Telerik team
Randy
Top achievements
Rank 1
Share this question
or