abrir una url con navegador EN VENTANA (Resuelto)
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Oct 13, 2023 6:14 pm
by jose_murugosa
He estado siguiendo el hilo en el foro de esto, aparentemente no se ha podido solucionar.
¿Hay una forma de abrir una página en el navegador y verla dentro de una ventana de mi aplicación?
Concretamente quiero usar la api de graphs de google y abrir en mi aplicación el gráfico correspondiente.
Hacerlo en el navegador es pan comido, pero incluirlo dentro de una ventana o un dockpanel..... es otro cantar.
Agradezco sugerencias.
Re: abrir una url con el navegador DENTRO DE UNA VENTANA
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Oct 13, 2023 6:26 pm
by Antonio Linares
Estimado José,
Aqui tienes un ejemplo funcionando:
chart.prg
- Code: Select all Expand view
// Please install https://developer.microsoft.com/en-us/m ... /webview2/ x86 version before using it#include "FiveWin.ch"function Main
() local oWebView := TWebView
():
New() oWebView:
SetHtml( Html
() ) oWebView:
SetTitle( "Using google charts" ) oWebView:
SetSize( 1200,
800 ) oWebView:
SetUserAgent( "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.53 Mobile Safari/537.36" ) sleep( 300 ) oWebView:
Run() oWebView:
Destroy()return nilfunction Html
() local cHtml
TEXT INTO cHtml
<html>
<head>
<script type=
"text/javascript" src=
"https://www.gstatic.com/charts/loader.js"></script>
<script type=
"text/javascript">
google.charts.load
("current",
{packages:
["corechart"]});
google.charts.setOnLoadCallback
(drawChart
);
function drawChart
() { var data = google.visualization.arrayToDataTable
([ ['Type',
'Megabytes'],
['HB_MEM_CHAR',
10 ],
['HB_MEM_BLOCK',
20 ],
['HB_MEM_RUN',
30 ],
['HB_MEM_VM',
40 ],
]);
var options =
{ title:
'mod_harbour > The Virtual Machine > Memory Management',
is3D:
true,
};
var chart =
new google.visualization.PieChart
(document.getElementById
('piechart_3d'));
chart.draw
(data, options
);
} </script>
</head>
<body>
<div
id=
"piechart_3d" style=
"width: 1200px; height: 800px;"></div>
</body>
</html>
ENDTEXT
return cHtml
![Image](https://github.com/FiveTechSoft/screenshots/blob/master/chart.png?raw=true)
Re: abrir una url con el navegador DENTRO DE UNA VENTANA
![Post Post](./styles/prosilver/imageset/icon_post_target.gif)
Posted:
Fri Oct 13, 2023 6:48 pm
by jose_murugosa
Muchas gracias Maestro.
Funciona perfectamente.