SendKeyEvent Cannot Type into Text Field

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

SendKeyEvent Cannot Type into Text Field

Postby kamsoonz » Mon Feb 23, 2015 9:32 pm

Hi,

I have problem typing text into textarea or text field using SendKeyEvent.

Platform: Ubuntu 14.04.2 LTS
CEF: 2272

Here is my code:
Code: Select all
          CefKeyEvent key;
          key.windows_key_code = 65; //it is 'a' in ubuntu
          key.modifiers = 0;
          key.is_system_key = 0;

          key.type = KEYEVENT_KEYDOWN;
          browser->GetHost()->SendKeyEvent(key);
          key.type = KEYEVENT_KEYUP;
          browser->GetHost()->SendKeyEvent(key);


I have run the key test at http://www.keyboardtester.com/tester.html and confirm the key is pressed.
But those pressed key just don't appear in the text area. The text area remain empty.

The textarea has the focus too because the cursor is there.

How can I type something into text area or text field using SendKeyEvent ?

I wanna simulate real keyboard input by not setting the value directly in javascript.

Thanks.

Alson
kamsoonz
Newbie
 
Posts: 1
Joined: Mon Feb 23, 2015 9:19 pm

Re: SendKeyEvent Cannot Type into Text Field

Postby magreenblatt » Tue Feb 24, 2015 4:02 pm

You're likely not sending the correct data via CefKeyEvent. See https://code.google.com/p/chromiumembed ... est.cc#559 for an example.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm

Re: SendKeyEvent Cannot Type into Text Field

Postby silver » Sat Apr 18, 2015 10:25 pm

magreenblatt wrote:You're likely not sending the correct data via CefKeyEvent. See https://code.google.com/p/chromiumembed ... est.cc#559 for an example.


In the sample code, how to send Enter key press ?
User avatar
silver
Techie
 
Posts: 48
Joined: Tue Feb 24, 2015 5:39 am


Return to Support Forum

Who is online

Users browsing this forum: No registered users and 63 guests