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

FloatingWindow and Key Events

3 Answers 138 Views
Dock
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 01 Jul 2017, 11:09 PM

I would like to be able to capture key events from a floating window.

Nothing I've tried seems to fire the OnKeyDown events associated with either the RadForm, FloatingParent or DockWindow.  I wired them up a variety of ways including in DockStateChanged.  Are the key events even intended to work for a floating window?

I'm using version 2017.2.613.40 of UI for WinForms.

I'm creating a new DockWindow with my user control which appears in the tabbed region in the middle of the RadDock.  I then float that window by dragging the tab.  Because the user may have several open floating windows, I want the global shortcut keys to function such as Ctrl+S to save everything even if they are in a floating window.  

Events DO fire from my control that is hosted in the floating window.  However, when one drags the floating window and the focus is on the window, key events don't fire.  

What's the proper way to wire of a floating window to capture key events?

 

3 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 03 Jul 2017, 10:24 AM
Hi Steve,

You should set the KeyPreview property when the floating window is created:
private void RadDock1_FloatingWindowCreated(object sender, Telerik.WinControls.UI.Docking.FloatingWindowEventArgs e)
{
    e.Window.KeyPreview = true;
   
    e.Window.KeyDown += Window_KeyDown;
}
 
private void Window_KeyDown(object sender, KeyEventArgs e)
{
   
}

I hope this will be useful. Let me know if you have additional questions.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Steve
Top achievements
Rank 1
answered on 03 Jul 2017, 04:21 PM

OK.  It's working now.  I was missing 

   e.Window.KeyPreview = true;

Thanks.

0
Steve
Top achievements
Rank 1
answered on 03 Jul 2017, 04:22 PM

OK.  It's working now.  I was missing

e.Window.KeyPreview = true;

Thanks.

Tags
Dock
Asked by
Steve
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Steve
Top achievements
Rank 1
Share this question
or