Loosing Keyboard Input

566 views
Skip to first unread message

robertarno...@gmail.com

unread,
Feb 17, 2015, 8:56:42 AM2/17/15
to cefs...@googlegroups.com
Hi,

I have found (what i think is a bug) that when using a touch screen on Windows 8 (only tested on Win 8) any text field on a web page gets keyboard input correctly but if i touch (not click) another window then touch the text field in the browser the caret appears but when i type with or without the on screen keyboard no text is entered into the field.

Note: When i use the mouse and click in the field the browser works as i expect.

Can anybody assist?

I'm running VS2013 and i created a new 32bit WinForms application and installed CefSharp v37 via the nuget package manger command line
"Install-Package CefSharp.WinForms -Version 37.0.0"

I have also tried it with v39-Pre02
"Install-Package CefSharp.WinForms -Pre"

The following is the only code i added

public partial class MainForm : Form
{
    public MainForm()
    {
        InitializeComponent();
        Cef.Initialize();

        ChromiumWebBrowser browser = new ChromiumWebBrowser("http://www.bing.com/")
        {
            Dock = DockStyle.Fill
        };


        Controls.Add(browser);
    }
}

thanks

Alex Maitland

unread,
Feb 18, 2015, 4:59:32 AM2/18/15
to cefs...@googlegroups.com
There are a few problems with focus, some improvements have been made and will be available in version `39.0.0`

See https://github.com/cefsharp/CefSharp/pull/791 for some more info (there are a few issues that relate to this problem, that's the most recent)

robertarno...@gmail.com

unread,
Feb 18, 2015, 9:16:57 AM2/18/15
to cefs...@googlegroups.com
Thanks Alex, that was very helpful

I have a workaround as a result of reading the pull page, well at least until the issue is fixed and tested.  Using the Activated event on the form call ChromiumWebBrowser.SetFocus(true); see the code below:

public partial class MainForm : Form
{
    ChromiumWebBrowser _browser = null;

    public MainForm()
    {
        InitializeComponent();
        Cef.Initialize();

        _browser = new ChromiumWebBrowser("http://www.bing.com/")
        {
            Dock = DockStyle.Fill
        };

        Controls.Add(_browser);

        Activated += MainForm_Activated;
    }

    void MainForm_Activated(object sender, EventArgs e)
    {
        _browser.SetFocus(true);
    }
}

Its not perfect but it works on v37 and v39 Pre02.  So i found that if i touch another window then touch a textbox in the browser the form doesn't activate but if i touch the title bar the form activates and the browser takes keyboard input from both the on screen keyboard as well as a normal keyboard.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages