I've an app which is very similar to the SimpleBrowser demo. Delphi 10.4 VCL, 1 fullscreen TWVBrowser, no address bar or other UI elements, just a a few setting/reload-buttons in a custom title bar. WebView4Delphi is not the latest version but definitely from 2023. Mostly works like a charm. Using it for a server side POS, so we need to process keyboard/scanner inputs. Now the strange thing: When we minimize the Window and then open it again, the browser lost focus and keyboard inputs don't reach the current document. I've checked windows + delphi forums and the 13 pages of focus releated posts+answers in this forum, but I don't find a clue.
I can catch Windows get back focus-event with
Code: Select all
private
SaveProc : TWndMethod;
procedure CommonWindowProc(var Message: TMessage);
Code: Select all
procedure TMainForm.FormCreate(Sender: TObject);
begin
SaveProc := WindowProc;
WindowProc := CommonWindowProc;
end;
procedure TMainForm.CommonWindowProc(var Message: TMessage);
begin
SaveProc(Message); // Call the original handler for the other form
case Message.Msg of
WM_SETFOCUS: WVBrowser1.SetFocus;
end;
end;
Code: Select all
Form.ActiveControl := WVBrowser1;
Does anyone have an idea what else I could do so that keyboard input reaches the web page again?
Regards,
Paul