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);
}