fpwebview

From Free Pascal wiki
Revision as of 19:13, 16 February 2022 by Alextpp (talk | contribs) (Created page with "'''fpwebview''' is Free Pascal binding for [https://github.com/webview/webview webview]. ==Getting started== Binary support files for x86_64 for Linux, macOS and Windows are...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

fpwebview is Free Pascal binding for webview.

Getting started

Binary support files for x86_64 for Linux, macOS and Windows are provided in the GitHub repo. See the files in the dll/x86_64 folder.

Linux

% git clone https://github.com/PierceNg/fpwebview
% cd fpwebview/demo/browser_cli
% ./linbuild.sh
<output>
% ./linrun.sh

macOS

% git clone https://github.com/PierceNg/fpwebview
% cd fpwebview/demo/browser_cli
% ./macbuild.sh
<output>
% ./macrun.sh

Windows

C:\> git clone https://github.com/PierceNg/fpwebview
C:\> cd fpwebview\demo\browser_cli
C:\fpwebview\demo\browser_cli> winbuild.bat
<output>
C:\fpwebview\demo\browser_cli> winrun.bat

Demo program

<syntaxhighight lang="pascal"> program browser_cli;

{$linklib libwebview}

uses

 {$ifdef unix}cthreads,{$endif}
 math,
 webview;

var

 w: PWebView;

begin

 { Set math masks. libwebview throws at least one of these from somewhere deep inside. }
 SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide, exOverflow, exUnderflow, exPrecision]);
 writeln('Hello, webview, from Pascal!');
 w := webview_create(WebView_DevTools, nil);
 webview_set_size(w, 1024, 768, WebView_Hint_None);
 webview_set_title(w, PAnsiChar('WebView Free Pascal'));
 webview_navigate(w, PAnsiChar('https://www.freepascal.org/'));
 webview_run(w);
 webview_destroy(w);
 writeln('Goodbye, webview.');

end. </syntaxhighlight>

Download

GitHub repo