Declined
Last Updated: 14 Mar 2025 17:12 by Curtis
Curtis
Created on: 12 Mar 2025 04:17
Category: UI for WinForms
Type: Bug Report
0
KeyPreview on RadRibbonForm does not bubble up arrow keys KeyDown or KeyUp events

I've tested this with both Telerik.WinControls.UI.RadForm and Telerik.WinControls.UI.RadRibbonForm

Telerik.WinControls.UI.RadForm works fine!  Telerik.WinControls.UI.RadRibbonForm fails to bubble up Keys.Up, Keys.Down, Keys.Left and Keys.Right

 

Steps:

Create new WinForms project (I'm using .net 4.7.2)

Add Telerik extensions. 

Add a Form (Windows Form default .Name = "Form1"), RadForm (default .Name = "RadForm1") and RadRibbonForm

You can use any Theme or default.  Makes no difference.

 

Set all three form's .KeyPreview = True

Add this method to each form:

Private Sub form_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Up Then
If My.Computer.Keyboard.ShiftKeyDown Then
MsgBox("Shift Up")
Else
MsgBox("Up!")
End If
End If
End Sub

Set your Startup Form = Form1 (The Windows Form) and click Start.

hit your UP-Arrow key.  You'll get the MsgBox "Up!"

Hold shift+UP-Arrow and you'll get "Shift Up"

The above is True for Winforms AND RadForm but RadRibbonForm does this:

 

Set your Startup Form = radribbonform and click Start

Hit your UP-Arrow and you'll get...nothing.  The event never gets raised.

Hold your shift+UP-Arrow and you'll get....nothing because the event does not fire when you hit any of the arrow keys.

 

 

 

 

 

2 comments
Curtis
Posted on: 14 Mar 2025 17:12

I was thinking it was probably the Ribbon!  I didn't want to see/know about this issue and not send you at least a bug report.

Thanks for looking into this and yes, thank you for the help on how to work around it!!

 

Cheers All.

 

ADMIN
Dinko | Tech Support Engineer
Posted on: 14 Mar 2025 14:59

Hi Curtis,

I appreciate the provided details. 

The reported behavior is not a bug. Internally, the arrow keys are handled by the RadRibbonBar control for its navigation purpose. If you want to catch the moment when the arrow keys are pressed by the end user, you can override the ProcessCmdKey method.

public partial class Form1 : RadRibbonForm
{
    public Form1()
    {
        InitializeComponent();
    }
    protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
    {
        if (keyData == Keys.Up || keyData == Keys.Down || keyData == Keys.Left || keyData == Keys.Right)
        {
            //custom logic               
        }
        return base.ProcessCmdKey(ref msg, keyData);
    }
}

Regards,
Dinko | Tech Support Engineer
Progress Telerik

Enjoyed our products? Share your experience on G2 and receive a $25 Amazon gift card for a limited time!