mobileFX WebKitX CEF3 ActiveX 4.x
WebKitXCEF3Lib ActiveX Control / WebKitXCEF3 Object / OnKeyPress Event

The ID of the browser generating the event.

Bit flags describing any pressed modifier keys.

The Windows key code for the key event. This value is used by the DOM specification. Sometimes it comes directly from the event (i.e. on Windows) and sometimes it's determined using a mapping function. See Keyboard Codes in samples below for the list of values.

The actual key code generated by the platform.

Indicates whether the event is considered a system key event (see http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).

The unicode character generated by the keystroke.

Same as character but unmodified by any concurrently-held modifiers (except shift). This is useful for working out shortcut keys.

True if the focus is currently on an editable field on the page. This is useful for determining if standard key events should be intercepted.

In This Topic
    OnKeyPress Event
    In This Topic
    Description

    Notification that a key transitioned from up to down. The event fires before the HTML renderer processes it.

    Syntax
    Visual Basic
    Public Event OnKeyPress( _
       ByVal BrowserID As Long, _
       ByVal Modifiers As Long, _
       ByVal WindowsKeyCode As Long, _
       ByVal NativeKeyCode As Long, _
       ByVal IsSystemKey As Boolean, _
       ByVal EventCharacter As String, _
       ByVal UnmodifiedCharacter As String, _
       ByVal IsFocusOnEditableField As Boolean _
    )
    Parameters
    BrowserID

    The ID of the browser generating the event.

    Modifiers

    Bit flags describing any pressed modifier keys.

    • EVENTFLAG_NONE = 0
    • EVENTFLAG_CAPS_LOCK_ON = 1 << 0
    • EVENTFLAG_SHIFT_DOWN = 1 << 1
    • EVENTFLAG_CONTROL_DOWN = 1 << 2
    • EVENTFLAG_ALT_DOWN = 1 << 3
    • EVENTFLAG_LEFT_MOUSE_BUTTON = 1 << 4
    • EVENTFLAG_MIDDLE_MOUSE_BUTTON = 1 << 5
    • EVENTFLAG_RIGHT_MOUSE_BUTTON = 1 << 6
    WindowsKeyCode

    The Windows key code for the key event. This value is used by the DOM specification. Sometimes it comes directly from the event (i.e. on Windows) and sometimes it's determined using a mapping function. See Keyboard Codes in samples below for the list of values.

    NativeKeyCode

    The actual key code generated by the platform.

    IsSystemKey

    Indicates whether the event is considered a system key event (see http://msdn.microsoft.com/en-us/library/ms646286(VS.85).aspx for details).

    EventCharacter

    The unicode character generated by the keystroke.

    UnmodifiedCharacter

    Same as character but unmodified by any concurrently-held modifiers (except shift). This is useful for working out shortcut keys.

    IsFocusOnEditableField

    True if the focus is currently on an editable field on the page. This is useful for determining if standard key events should be intercepted.

    Remarks

    Notification that a key transitioned from up to down.

    The event fires before the HTML renderer processes it.

    Event transmission from Chromium to ActiveX is asynchronous and event cannot be mutated.

    Example
    Private Sub WebKitX1_OnKeyPress(ByVal BrowserID As Long, ByVal Modifiers As Long, ByVal WindowsKeyCode As Long, ByVal NativeKeyCode As Long, ByVal IsSystemKey As Boolean, ByVal EventCharacter As String, ByVal UnmodifiedCharacter As String, ByVal IsFocusOnEditableField As Boolean)
    
        Dim Zoom As Double
        
        If WindowsKeyCode = 116 Then
            WebKitX1.Reload True
        End If
        
        Select Case EventCharacter
        
        ' Set zoom to 100%
        Case "=":
            WebKitX1.Zoom = 1
        
        ' Increase zoom by +20%
        Case "+":
            Zoom = WebKitX1.Zoom
            WebKitX1.Zoom = Zoom + 0.2
            
        ' Decrease zoom by -20%
        Case "-":
            Zoom = WebKitX1.Zoom
            WebKitX1.Zoom = Zoom - 0.2
            
        Case "*"
            WebKitX1.Eval "document.body.style.cssText='transform:scale3d(0.5, 0.5, 0.5);'"
            
        End Select
    
    End Sub
    See Also