fork download
  1.  
  2. //Called when application is started.
  3. function OnStart()
  4. {
  5. //Create a layout with objects vertically centered.
  6. lay = app.CreateLayout( "linear", "VCenter,FillXY" );
  7.  
  8. //Create image 1/5 of screen width and correct aspect ratio.
  9. img = app.CreateImage( "/Sys/Img/Hello.png", 0.2, -1 );
  10. lay.AddChild( img );
  11.  
  12. //Create a button 1/3 of screen width and 1/10 screen height.
  13. btn = app.CreateButton( "Press Me", 0.3, 0.1 );
  14. btn.SetMargins( 0, 0.05, 0, 0 );
  15. lay.AddChild( btn );
  16.  
  17. //Set function to call when button pressed.
  18. btn.SetOnTouch( btn_OnTouch );
  19.  
  20. //Add layout to app.
  21. app.AddLayout( lay );
  22. }
  23.  
  24. //Called when user touches our button.
  25. function btn_OnTouch()
  26. {
  27. //Show a popup message.
  28. app.ShowPopup( "Hello World!" );
  29.  
  30. //Vibrate phone with a pattern (in milliseconds).
  31. //pause,vibrate,pause,vibrate...
  32. app.Vibrate( "0,100,30,100,50,300" );
  33. }
  34.  
Success #stdin #stdout 0.35s 39916KB
stdin
Standard input is empty
stdout
Standard output is empty