Forum > Packages and Libraries
HTMLViewer JavaScript demos problems
JD:
Hi there,
I want to try the javascript demos included with HTMLViewer (FrameDemJavaScriptUsingBesen and/or FrameDemJavaScriptUsingBesenW).
I've already downloaded the extra Besen files needed by these examples. After much tweaking, I finally compiled them both.
However running both programs has no visible result apart from eating up my CPU.
Has anyone succeeded in using HTMLViewer to display HTML with javascript files.
Thanks,
JD
Phil:
--- Quote from: JD on February 10, 2018, 05:40:58 pm ---Has anyone succeeded in using HTMLViewer to display HTML with javascript files.
--- End quote ---
Why not use an actual Web browser-based control instead of ancient stuff like HTMLViewer?
That's the idea behind TWebBrowser.
https://macpgmr.github.io/
JD:
--- Quote from: Phil on February 10, 2018, 05:57:53 pm ---
--- Quote from: JD on February 10, 2018, 05:40:58 pm ---Has anyone succeeded in using HTMLViewer to display HTML with javascript files.
--- End quote ---
Why not use an actual Web browser-based control instead of ancient stuff like HTMLViewer?
That's the idea behind TWebBrowser.
https://macpgmr.github.io/
--- End quote ---
Thanks for the tip Phil. I've downloaded and installed the TWebBrowser component. How does it work? Do you have a demo you can share? I want to be able to display an HTML/JavaScript file like the one at https://developers.google.com/chart/interactive/docs/quick_start
--- Code: HTML5 [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---<html> <head> <!--Load the AJAX API--> <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> <script type="text/javascript"> // Load the Visualization API and the corechart package. google.charts.load('current', {'packages':['corechart']}); // Set a callback to run when the Google Visualization API is loaded. google.charts.setOnLoadCallback(drawChart); // Callback that creates and populates a data table, // instantiates the pie chart, passes in the data and // draws it. function drawChart() { // Create the data table. var data = new google.visualization.DataTable(); data.addColumn('string', 'Topping'); data.addColumn('number', 'Slices'); data.addRows([ ['Mushrooms', 3], ['Onions', 1], ['Olives', 1], ['Zucchini', 1], ['Pepperoni', 2] ]); // Set chart options var options = {'title':'How Much Pizza I Ate Last Night', 'width':400, 'height':300}; // Instantiate and draw our chart, passing in some options. var chart = new google.visualization.PieChart(document.getElementById('chart_div')); chart.draw(data, options); } </script> </head> <body> <!--Div that will hold the pie chart--> <div id="chart_div"></div> </body></html>
Thanks a lot,
JD
Phil:
--- Quote from: JD on February 10, 2018, 06:22:40 pm ---Do you have a demo you can share?
--- End quote ---
Yes, it includes the PasMap app, which is the Laz version of this Xcode app:
https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html#EmbeddedBrowser
JD:
--- Quote from: Phil on February 10, 2018, 06:27:11 pm ---
--- Quote from: JD on February 10, 2018, 06:22:40 pm ---Do you have a demo you can share?
--- End quote ---
Yes, it includes the PasMap app, which is the Laz version of this Xcode app:
https://macpgmr.github.io/MacXPlatform/WebAppOverview_3.html#EmbeddedBrowser
--- End quote ---
The PasMap app is not working for me. Nothing is displayed in the form.
In addition the following simple example does not work either
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---unit Unit1; {$mode objfpc}{$H+} interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, WebBrowser; type { TForm1 } TForm1 = class(TForm) Button1: TButton; WebBrowser1: TWebBrowser; procedure Button1Click(Sender: TObject); procedure WebBrowser1PageLoaded(Sender: TObject); procedure WebBrowser1PageLoadError(Sender: TObject); private public end; var Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);begin WebBrowser1.LoadPage('www.microsoft.com');end; procedure TForm1.WebBrowser1PageLoaded(Sender: TObject);begin ShowMessage('Page loaded successfully');end; procedure TForm1.WebBrowser1PageLoadError(Sender: TObject);begin ShowMessage('Error loading page');end; end.
I just want something that can display local HTML/JavaScript files created by another application. I don't want to go the Electron route because of bloat and memory consumption of Electron apps.
cheers,
JD
Navigation
[0] Message Index
[#] Next page