Recent

Author Topic: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard  (Read 2070 times)

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
Hi,

I just added a new KioskBrowser demo for Lazarus in the CEF4Delphi and WebView4Delphi projects.

This demo implements the virtual touch keyboard in Windows using the ITipInvocation, IInputHostManagerBroker and IImmersiveShellBroker interfaces.
https://github.com/salvadordf/CEF4Delphi/blob/master/demos/Lazarus_Windows/KioskBrowser/uVirtualTouchKeyboard.pas

Those interfaces are not documented but they are available in Windows 8, 10 and 11 they work best in a fully updated Windows 10 or 11 system.

The attached picture shows the KioskBrowser demo for Lazarus in the WebView4Delphi project.
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

loaded

  • Hero Member
  • *****
  • Posts: 876
Thank you very much for your work salvadordf 👏
The more memory computers have, the less memory people seem to use. 😅

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #2 on: September 03, 2025, 07:51:59 am »
Thank you for your efforts, salvadordf.
When I install Webview4Delphi, where are the example projects stored?

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #3 on: September 03, 2025, 07:54:53 am »
I found it.
They are under..
 
    C:\Users\USER\AppData\Local\lazarus\onlinepackagemanager\packages\WebView4Delphi\demos\Lazarus

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #4 on: September 04, 2025, 06:22:49 am »
Thank you salvadordf for your programs.

But when I installed WebView4Delphi, I couldn't see components in the object inspector. This happened in two separate PCs. Could you check this?

Regards,

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #5 on: September 04, 2025, 09:05:30 am »
I'm trying to make this work, following the example of your SimpleBrowser. But I cannot make my first demo run.
Simply nothing appears on the form.

Code: Pascal  [Select][+][-]
  1. program project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.    {$IFDEF UNIX}
  7.    cthreads,
  8.    {$ENDIF}
  9.    {$IFDEF HASAMIGA}
  10.    athreads,
  11.    {$ENDIF}
  12.    Interfaces, // this includes the LCL widgetset
  13.    Forms, Unit1
  14.    { you can add units after this };
  15.  
  16. {$R *.res}
  17.  
  18. begin
  19.    RequireDerivedFormResource:=True;
  20.    Application.Scaled:=True;
  21.    {$PUSH}{$WARN 5044 OFF}
  22.    Application.MainFormOnTaskbar:=True;
  23.    {$POP}
  24.    Application.Initialize;
  25.    Application.CreateForm(TForm1, Form1);
  26.    Application.Run;
  27. end.
  28.  
  29.  
  30. unit Unit1;
  31.  
  32. {$mode objfpc}{$H+}
  33.  
  34. interface
  35.  
  36. uses
  37.    Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
  38.    uWVBrowser, uWVWindowParent, uWVLoader,
  39.    uWVBrowserBase;
  40.  
  41. type
  42.  
  43.    { TForm1 }
  44.  
  45.    TForm1 = class(TForm)
  46.       Button1: TButton;
  47.       WVBrowser1: TWVBrowser;
  48.       WVWindowParent1: TWVWindowParent;
  49.       procedure Button1Click(Sender: TObject);
  50.       procedure FormShow(Sender: TObject);
  51.    private
  52.  
  53.    public
  54.  
  55.    end;
  56.  
  57. var
  58.    Form1: TForm1;
  59.  
  60. implementation
  61.  
  62. {$R *.lfm}
  63.  
  64. { TForm1 }
  65.  
  66. procedure TForm1.Button1Click(Sender: TObject);
  67. begin
  68.    WVBrowser1.Navigate(UTF8Decode('http://www.alphaq.biz'));
  69. end;
  70.  
  71. procedure TForm1.FormShow(Sender: TObject);
  72. begin
  73.   if GlobalWebView2Loader.InitializationError then
  74.     showmessage(UTF8Encode(GlobalWebView2Loader.ErrorMessage))
  75.    else
  76.     if GlobalWebView2Loader.Initialized then
  77.       WVBrowser1.CreateBrowser(WVWindowParent1.Handle)
  78.      else
  79.       // Timer1.Enabled := True;
  80. end;
  81.  
  82. initialization
  83.   GlobalWebView2Loader                := TWVLoader.Create(nil);
  84.   GlobalWebView2Loader.UserDataFolder := UTF8Decode(ExtractFileDir(Application.ExeName) + '\CustomCache');
  85.   GlobalWebView2Loader.StartWebView2;
  86.  
  87. end.

What I have changed in the object inspector are:

- WVBrowser1.DefaultURL = https://www.bing.com
- WVWindowParent1.Browser = WVBrowser1


The SimpleBrowser project works well.

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #6 on: September 04, 2025, 10:48:44 am »
I'm sorry. My previous example works. Simply too slow (My PC has 4 GB memory).
But stil it needs some kind of refresh, as I can see the content when I resize the form.
« Last Edit: September 04, 2025, 10:53:27 am by egsuh »

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #7 on: September 04, 2025, 10:55:21 am »
Thank you salvadordf for your programs.

But when I installed WebView4Delphi, I couldn't see components in the object inspector. This happened in two separate PCs. Could you check this?

Regards,
It works as expected. See the attachment.
« Last Edit: September 04, 2025, 10:58:06 am by salvadordf »
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #8 on: September 04, 2025, 12:11:18 pm »
Once I reinstall Lazarus, and then some packages including Webview4Delphi through OnlinePackageManager, the program goes away. Currently my computers work fine.

salvadordf

  • Jr. Member
  • **
  • Posts: 68
    • BriskBard
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #9 on: September 04, 2025, 12:24:52 pm »
Reinstalling Lazarus also restores the Lazarus executable. If you had components that require rebuilding the IDE then they will probably stop working until you install them again and rebuild Lazarus.
Maintainer of the CEF4Delphi, WebView4Delphi, WebUI4Delphi and WebUI4CSharp projects

egsuh

  • Hero Member
  • *****
  • Posts: 1696
Re: KioskBrowser demo in CEF4Delphi and WebView4Delphi with a virtual keyboard
« Reply #10 on: September 04, 2025, 12:52:01 pm »
Hi salvadordf,

Thank you again for your programs. To summarize:

- My Lazaruses were working fine.
- When I first installed WebView4Delphi, I couldn't see the components in the Object inspector.
- I reinstalled Lazarus and the packages I used to use (via online package manager), then I can see components in the object inspector.
- And I can use Webview4Delphi. But the content of webpage is not displayed automatically until I resize the form.
- Now I have added the following event handler, and the form automatically display the content of webpage.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.WVBrowser1AfterCreated(Sender: TObject);
  2. begin
  3.    WVWindowParent1.UpdateSize;
  4. end;
  5.  

- So I wonder TWVWindowParent does not display the content of the webpage until its size is updated.

This is my experience, and now I can use your component for my application --- to preview HTML  (and maybe + javascript) produced by my application. The old HTMLViewer were too limited, as it cannot process many features of recent HTML5. So I really appreciate your efforts and products.

The small issues I wrote here are just for your information. I can not bypass them. And I hope that they can contribute to enhancing your products further.

 

TinyPortal © 2005-2018