Unplanned
Last Updated: 24 Dec 2019 08:53 by ADMIN
Riziq
Created on: 23 Dec 2019 11:14
Category: PopupEditor
Type: Feature Request
0
PopupManager: improve its API to provide handling of the keyboard input

Use case: when RadPopupEditor is opened, the focus is sent to the popup control which handles all the pressed keys. It would be added public API which provides the possibility to plug into this keyboard handling and customize the behavior.

For example, when the popup is opened, pressing Escape, closes the popup. This functionality comes from the RadPopupContainerForm.OnKeyDown which behavior can't be overridden.

Currently, only the listener can be removed for a certain popup:

    Private Sub RadPopupEditor_PopupOpened(sender As Object, e As EventArgs)       PopupManager.Default.RemovePopup(Me.RadPopupEditor1.PopupEditorElement.PopupContainerForm)
    End Sub

2 comments
ADMIN
Dess | Tech Support Engineer, Sr.
Posted on: 24 Dec 2019 08:53
Hello, Riziq,     

I am glad that you have found a suitable solution for your custom scenario. Thank you for sharing the code snippet with the community.

However, I can't guarantee that it would work properly in all cases with RadPopupEditor. Feel free to use it if it fits your requirements.

We will definitely consider it when addressing this feedback item in order to provide the best possible API for handling the keyboard in the RadPopupEditor's drop down.

Should you have further questions please let me know.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Riziq
Posted on: 23 Dec 2019 13:42
Public Const MOD_ALT As Integer = &H1
Public Const MOD_SHIFT As Integer = &H10
Public Const VK_CONTROL As Integer = &H11
Public Const WM_HOTKEY As Integer = &H312
 
<DllImport("User32.dll")>
Public Shared Function RegisterHotKey(ByVal hwnd As IntPtrByVal id As IntegerByVal fsModifiers As IntegerByVal vk As IntegerAs Integer
End Function
 
<DllImport("User32.dll")>
Public Shared Function UnregisterHotKey(ByVal hwnd As IntPtrByVal id As IntegerAs Integer
End Function
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
 
    If m.Msg = WM_HOTKEY Then
 
        Dim id As IntPtr = m.WParam
 
        Select Case (id.ToString)
 
            Case "100"
 
                MsgBox("F2 Pressed")
 
            Case "200"
 
                MsgBox("ALT+D Pressed")
 
            Case "300"
 
                MsgBox("ALT+C Pressed")
 
        End Select
 
    End If
 
    MyBase.WndProc(m)
 
End Sub
 
Public Sub HotKeys_Register()
 
    RegisterHotKey(Me.Handle, 100NothingKeys.F2)
    RegisterHotKey(Me.Handle, 200, MOD_ALT, Keys.D)
    RegisterHotKey(Me.Handle, 300, MOD_ALT, Keys.C)
 
End Sub
 
Public Sub HotKeys_Unregister()
 
    UnregisterHotKey(Me.Handle, 100)
    UnregisterHotKey(Me.Handle, 200)
    UnregisterHotKey(Me.Handle, 300)
 
End Sub
 
Private Sub myPopupEditor_PopupOpened(sender As Objecte As EventArgsHandles myPopUpEditor.PopupOpened
 
    Me.myLookUpContainer.HotKeys_Register()
 
End Sub
 
Private Sub myPopUpEditor_PopupClosed(sender As Objectargs As RadPopupClosedEventArgs) Handles myPopUpEditor.PopupClosed
 
    Me.myLookUpContainer.HotKeys_Unregister()
 
End Sub