User Tools

Site Tools


Sidebar

Privacy Policy

News

Version 2.50 is out since Jan 1st 2022


Frequently Asked Questions


Namespaces

Note for contributors

If you wish to create a new page in the DroidScript wiki, please click on the most appropriate namespace above and follow the notes for contributors there.

Because of spam, it has been necessary to add a CAPTCHA to the registration form and the save option for editing pages. You will not need to prove you are human if you are logged in, so please register.

Please feel free to improve any existing page, as well as adding new pages to increase the sum of public knowledge about DroidScript.

Formatting Syntax

sample_code:sample_web_view

Web View Example

webview.js
//web view example
//Called when application is started. 
function OnStart() 
{ 
    //Create a layout with objects vertically centered. 
    lay = app.CreateLayout( "linear""VCenter,FillXY" );     
    //Create a web control. 
    web = app.CreateWebView( 11,"AllowZoom,Wide,AutoZoom",50 ); 
 
    //setup loading... progress
    web.SetOnProgress( web_OnProgess ); 
 
    //add web to layout
    lay.AddChild( web ); 
     
    //Create horizontal layout
    layHoriz = app.CreateLayout( "linear""Horizontal" ); 
     
    //Add horizontal layout to main layout. 
    lay.AddChild( layHoriz ); 
     
    //Add layout to app.     
    app.AddLayout( lay ); 
 
   //call load web page function
   loadWeb() 
} 
 
 
//******functions******//
 
 
//Load web page
function loadWeb()
{ 
  //show progress bar
  app.ShowProgressBar("Loading...",0);
  //load url
  web.LoadUrl("http://m.cat5.tv" ); 
} 
 
//Show page load progress. 
function web_OnProgess( progress ) 
{   
  //update progress bar
  app.UpdateProgressBar(progress);
  //get progress update
  app.Debug( "progress = " + progress ); 
  //hide progress dialog when page loads
  if( progress==100 ) app.HideProgressBar(); 
} 
 
//handle orienation change 
function OnConfig()
{
  //resize web view on orientation change
  web.SetSize(1,1);
}
 
sample_code/sample_web_view.txt · Last modified: 2014/12/15 09:58 (external edit)