Events on keys of VirtualKeyboardForm

1 Answer 30 Views
VirtualKeyboard
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Jana asked on 24 Sep 2021, 12:56 PM

Hello,

I would like to use the virtualKeyboardForm in a WinForms application on a tablet. I would like to know if it's possible to fire event when pressing specific keys.

For example: if I click on the cross in the top right corner of the virtualKeyboardForm, I want that the associated textbox is not focused anymore. Or that if I click on Enter, the keyboardform will close automatically and the associated textbox loses its focus.

Is there a possibility to achieve this?

Thank you in advance and have a nice day!

1 Answer, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 27 Sep 2021, 09:18 AM

Hello Jana,

The virtual key board element exposes the KeySent event and you can handle it and be notified for the key code. For example, you can check for Enter this way:

this.radVirtualKeyboardForm1.KeyboardForm.VirtualKeyboard.KeySent += VirtualKeyboard_KeySent;

private void VirtualKeyboard_KeySent(object sender, Telerik.WinControls.VirtualKeyboard.VirtualKeyboardKeySentEventArgs e)
{
    if (e.VirtualKey.HasValue && e.VirtualKey.Value == (int)Keys.Enter)
    {
        Console.WriteLine("Enter key pressed!");
    }
}

As for the close button, it is actually part of the form's title bar. You can access the button element and subscribe to its Click event, then in the handler you can move the focus elsewhere: 

this.radVirtualKeyboardForm1.KeyboardForm.FormElement.TitleBar.CloseButton.Click += CloseButton_Click;

I hope this will help. Let me know if you need further assistance.

Regards,
Hristo
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
VirtualKeyboard
Asked by
Jana
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Hristo
Telerik team
Share this question
or