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

Overriding OnKeyDown

7 Answers 81 Views
NumericUpDown
This is a migrated thread and some comments may be shown as answers.
Andrea
Top achievements
Rank 1
Andrea asked on 29 Apr 2014, 10:18 AM
Hi,

We are using numeric up downs in a grid, but we do not want the up and down keys to change the value as we would like to preserve them for navigating around the grid. Previously, we were able to do this by overriding the OnKeyDown event. Since updating to 2014.1.224 from 2013.2.0611, this no longer works. I've compared the two binaries with reflector and it looks like the signature of the OnKeyDown event has changed from OnKeyDown(KeyEventsArgs e) to OnKeyDown(object sender, KeyEventsArgs e). We are unable to override this new event, and therefore the base one is always firing.

Can you provide a workaround please?

Thanks,
Andrea

7 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 30 Apr 2014, 12:26 PM
Hello Andrea,

The change is the following - we are no longer overriding the OnKeyDown of the TextBox inside the NumericUpDown, but hooking to the event. So, I would suggest you to do the same.
Please give it a try and let us know if this is working for you.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Andrea
Top achievements
Rank 1
answered on 01 May 2014, 08:36 AM
Hi Konstantina,

Thanks for getting back to me. However, that didn't work. It looks like the RadNumericUpDown class attaches to the evfent handler like this:

base.AddHandler(UIElement.KeyDownEvent, new KeyEventHandler(this.OnKeyDown), true);


The last argument to AddHandler is described as follows:
 
handledEventsToo
Type: System.Boolean
true to register the handler such that it is invoked even when the routed event is marked handled in its event data; false to register the handler with the default condition that it will not be invoked if the routed event is already marked handled.
The default is false.
Do not routinely ask to rehandle a routed event. For more information, see Remarks

Even if I set Handled = true in my event handler, it won't stop your handler from running.

Any ideas?
Thanks,
Andrea

0
Kalin
Telerik team
answered on 06 May 2014, 07:12 AM
Hi Andrea,

We understand your concern. However we will need additional time to research for a proper solution. We will get back to you as soon as possible.

Thanks for the understanding.

Regards,
Kalin
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Andrea
Top achievements
Rank 1
answered on 06 May 2014, 07:52 AM
Hi Kalin,

Thanks for getting back to me. Are you able to advise of any timescales? Does it help if I log this as a support ticket?

Thanks,
Andrea
0
Konstantina
Telerik team
answered on 08 May 2014, 03:00 PM
Hello Andrea,

Thank you for your patience.

We have thoroughly researched the possibility of changing this behavior, but that will break the already fixed bug. However, I am sending you a sample application in which I have proposed a work-around to achieve the desired behavior.

Hope it helps.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Andrea
Top achievements
Rank 1
answered on 13 May 2014, 08:05 AM
Hi Kalin,
Thanks! However, I haven't received the sample application? Were you going to attach it to your post or am I just being blind and not seeing it?

Thanks,
Andrea
0
Konstantina
Telerik team
answered on 13 May 2014, 08:11 AM
Hi Andrea,

Sorry, there was a problem with the post.
I have attached it to the previous post. Please download it and give it a try.

Regards,
Konstantina
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
NumericUpDown
Asked by
Andrea
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Andrea
Top achievements
Rank 1
Kalin
Telerik team
Share this question
or