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

How to disable MouseWheel for RadDateTimePicker

6 Answers 465 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Taylor
Top achievements
Rank 1
Taylor asked on 25 Jan 2011, 05:45 PM
My application has a RadDateTimePicker at the top of most forms; often the forms require some scrolling.  When a user enters the form, the RadDateTimePicker gets focus, and then when he tries to scroll down the form, he instead will inadvertently scroll the date, then (when the month reaches 12, its highest value) the form will scroll.  The user often will not know that he accidently changed a value.

My users never want to scroll the date (they are always surprised when I point out to them that it does scroll), so I want to turn off that functionality.  My first thought was to get the event handler and set Handled to true ... but there is no such property on that event handler.  Then, even though I knew better, I tried to go down the road of removing the existing handlers ... but even Reflection balks at that.

So, is there a way for me to disable the MouseWheel event in the RadDateTimePicker?  Or do you have alternate suggestions?

Thanks!

6 Answers, 1 is accepted

Sort by
0
Accepted
Richard Slade
Top achievements
Rank 2
answered on 25 Jan 2011, 11:23 PM
Hi Brandon,

This doesn't disable the mouse wheel, but it does reset the value, which in effect, renders the mouse wheel useless. There may be other ways, but it's the simplest solution I can think of so far.

    AddHandler Me.RadDateTimePicker1.DateTimePickerElement.TextBoxElement.TextBoxItem.MouseWheel, AddressOf RadDateTimePicker_MouseWheel
Private Sub RadDateTimePicker_MouseWheel(ByVal sender As Object, ByVal e As MouseEventArgs)
    If e.Delta > 0 Then
        SendKeys.Send("{DOWN}")
    Else
        SendKeys.Send("{UP}")
    End If
End Sub

Hope that helps but let me know if you have any questions
Regards,
Richard
0
Taylor
Top achievements
Rank 1
answered on 26 Jan 2011, 12:28 AM
That did it.  Thanks!
0
Joem
Top achievements
Rank 2
answered on 04 Dec 2015, 06:16 AM
Is this the best solution for the problem how to the scrolling of datetimepicker? MulticolumnCombobox has ScrollOnMouseWheel, why not a similar function for datetimepicker?
0
Joem
Top achievements
Rank 2
answered on 04 Dec 2015, 06:20 AM

Just to add,

using the above workaround, upon scrolling on a datetimepicker set to nulltext, the control will be having a new value.

0
Joem
Top achievements
Rank 2
answered on 04 Dec 2015, 06:41 AM

I think this is the right choice.

dateTimePicker.DateTimePickerElement.TextBoxElement.EnableMouseWheel = false;

0
Hristo
Telerik team
answered on 04 Dec 2015, 01:54 PM
Hi ,

Thank you for writing.

The EnableMouseWheel property was introduced at the end of 2011, so with any later versions of the controls this is the correct way to handle this type of scenario.

Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
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 Feedback Portal and vote to affect the priority of the items
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Taylor
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Taylor
Top achievements
Rank 1
Joem
Top achievements
Rank 2
Hristo
Telerik team
Share this question
or