How to set focus to / set caret into input field
Posted: Mon Jan 20, 2020 1:32 pm
I know this issue has been discussed many times, but still I cant get it to work. I think I tried every suggestion from every forum but still my input field does not get "a blinking caret" in it, such that the user just can start typing.
I already tried:
A)
This is nicely scrolling my web page such that the input field gets visible. But no caret blinking in field.
B)
Still no caret blinking in field.
C)
Still no caret blinking in field.
Using MBT_RIGHT I can see I'm on the right track because a popup menu shows up nicely in the upper left corner of the input field.
It can't be that complicated, but obviously I'm missing the obvious.
Any help would be very much appreciated.
Many thanks, Lu53
I already tried:
A)
Code: Select all
Javascript:
element.focus();
B)
Code: Select all
Javascript:
element.focus();
Followed by Delphi:
MyForm.ActiveControl := CEFWindowParent1;
MyForm.Chromium1.SetFocus(True);
C)
Code: Select all
Javascript:
element.focus();
var Pos = element.getBoundingClientRect();
and returning Pos.x and Pos.y to Delphi
Followed by Delphi:
Var MouseEvent: TCefMouseEvent;
MouseEvent.x := X+5;
MouseEvent.y := Y+5;
Chromium1.Browser.Host.SendFocusEvent(true);
Chromium1.Browser.Host.SendMouseClickEvent(PCefMouseEvent(@MouseEvent), MBT_LEFT, false, 1);
Chromium1.Browser.Host.SendMouseClickEvent(PCefMouseEvent(@MouseEvent), MBT_LEFT, true, 1);
Using MBT_RIGHT I can see I'm on the right track because a popup menu shows up nicely in the upper left corner of the input field.
It can't be that complicated, but obviously I'm missing the obvious.
Any help would be very much appreciated.
Many thanks, Lu53