hotkeys

Having problems with building or using the CefSharp .NET binding? Ask your CEF-related questions here. Please ask general usage questions on StackOverflow.

Moderator: amaitland

hotkeys

Postby Maksimmkv » Fri Sep 24, 2021 7:41 am

Hi everyone. Implemented the IKeyboardHandler interface, in which I update the page by pressing the button. Now you need to press the key combination (for example: ctrl + A), click the button.

My code:
Code: Select all
        public bool OnPreKeyEvent(IWebBrowser chromiumWebBrowser, IBrowser browser, KeyType type, int windowsKeyCode, int nativeKeyCode, CefEventFlags modifiers, bool isSystemKey, ref bool isKeyboardShortcut)
        {
            if (type == KeyType.KeyUp && Enum.IsDefined(typeof(Keys), windowsKeyCode))
            {
                var key = (Keys)windowsKeyCode;
                switch (key)
                {
                    case Keys.F5:
                        browser.Reload(true);
                        break;
                }
            }
            return false;
        }


Attempt:

Code: Select all
    case Keys.Multiply(Keys.Control | Keys.A):
                        button1.PerformClick();
                        break;

Severity   Code   Description   Project   File   Line   Suppression State
Error   CS0426   The type name 'Multiply' does not exist in the type 'Keys'   WindowsFormsApp1   H:\1\System\WindowsFormsApp1\MyKeyboardHandler.cs   30   Active



Thank's
Maksimmkv
Newbie
 
Posts: 7
Joined: Tue Aug 03, 2021 2:19 pm

Re: hotkeys

Postby amaitland » Fri Sep 24, 2021 2:13 pm

What is your question exactly?
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am

Re: hotkeys

Postby Maksimmkv » Sat Sep 25, 2021 4:03 am

Key combination does not work ctrl + A.
Maksimmkv
Newbie
 
Posts: 7
Joined: Tue Aug 03, 2021 2:19 pm

Re: hotkeys

Postby amaitland » Sat Sep 25, 2021 4:21 am

Ctrl is a modifier.
Maintainer of the CefSharp project.
amaitland
Virtuoso
 
Posts: 1290
Joined: Wed Jan 14, 2015 2:35 am


Return to CefSharp Forum

Who is online

Users browsing this forum: No registered users and 18 guests