WebView creates a WebView control to display local or remote web pages in the app.
Example - Remote
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
web = app.CreateWebView( 0.8, 0.8 );
web.SetOnProgress( web_OnProgess );
lay.AddChild( web );
app.AddLayout( lay );
app.ShowProgress("Loading...");
web.LoadUrl( "http:///www.google.com" );
}
function web_OnProgess( progress )
{
app.Debug( "progress = " + progress );
if( progress==100 ) app.HideProgress();
}
Example - Local
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
web = app.CreateWebView( 0.8, 0.8 );
web.SetBackColor( "#00000000" );
lay.AddChild( web );
app.AddLayout( lay );
web.LoadUrl( "file:///Sys/Html/Page.htm" );
}
Example - Direct
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
web = app.CreateWebView( 0.8, 0.8 );
web.SetBackColor( "#00000000" );
lay.AddChild( web );
app.AddLayout( lay );
var html = "<html><head>";
html += "<meta name='viewport' content='width=device-width'>";
html += "</head><body>Hello World!<br>";
html += "<img src='Img/Droid2.png'>";
html += "</body></html>";
web.LoadHtml( html, "file:///Sys/" );
}
The following methods are avaiable on the WebView object:
GetPosition(
options ) ->
object - { left: fraction of parent width, top: fraction of parent height, right: fraction of parent width, bottom: fraction of parent height }
unknown
number
set color effects
load previous page if possible
returns wether there is a previous page
returns wether there is a following page
string - path to file or folder ( "/absolute/..." or "relative/..." )
? screenshot?
?
ClearHistory for Back() and Forward()
destroys object
destroys object with explode animation and sound
?
losd next page
get height in pixels
get width in pixels
get screen relative height
get distance to left parent border
get distance to upper parent border
returns current website url
GetVisibility
get screen relative width
Set visibility "Gone"
Set visibility "Hide"
IsEnabled
app object
number - fraction of screen width
return wether obj overlap with an other
IsVisible
string - html
string - url path
LoadUrl
string
number - integer
boolean
called when console was accessed
Print current page
?
Reload current page
string -
hexadecimal: "#rrggbb", "#aarrggbb"
colourName: "red", "green", ...
SetBackColor
number - fraction of screen height
SetBackColorRadial
changes the background image
string - "Add" or "Multiply" or "?"
adjust color
en/disable object
move object from current position
called when error appeared
?
set surrounding borders
SetPosition
?
number - factor
SetScale
change object size
?
?
string - "Show" or "Hide" or "Gone"
change visibility mode
Set visibility "Show"
?
?
object id