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

Keydown and Keypress don't fire for cursor keys.

2 Answers 205 Views
ChartView
This is a migrated thread and some comments may be shown as answers.
Phillip
Top achievements
Rank 1
Phillip asked on 05 Nov 2018, 09:33 AM

Hi,

I'm trying to allow additional data on my chart to be panned through via the arrow keys but it appears that keydown and keypress events aren't firing for the cursor keys. Keyup DOES fire on arrow keys at least, but I'd much rather have it happen on keydown. Is there a reason for this behaviour or a workaround/setting I've not noticed?

Thanks

2 Answers, 1 is accepted

Sort by
0
Phillip
Top achievements
Rank 1
answered on 05 Nov 2018, 04:36 PM

So I ended up finding out the answer to this while chasing up some odd KeyUp behaviour and I figured I'd best post it here in case it comes up for anyone else.

This is actually default WinForms behaviour, summarized in this article's remarks. Basically you need to use the PreviewKeyDown event and decide you want the key to be treated as an input key for it to trigger KeyPress and KeyDown. Not exactly sure why KeyUp is exempt from this yet but it's not a Telerik-exclusive issue in any case.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 06 Nov 2018, 08:26 AM
Hello, Phillip, 
  
I am glad that the problem you were facing is now resolved. Indeed, the PreviewKeyDown event is appropriate for handling before the KeyDown is actually triggered. The referred MSDN article explains in details how to proceed in this case. 

I would recommend to have a look at the MSDN forum and StackOverflow for general programming questions like this. 

Should you have further questions regarding the Telerik UI for WinForms suite please let me know.

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
ChartView
Asked by
Phillip
Top achievements
Rank 1
Answers by
Phillip
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or