User Tools

Site Tools


sample_code:droidscript_console

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

sample_code:droidscript_console [2016/10/14 21:49]
197.178.113.63
sample_code:droidscript_console [2016/10/31 05:41]
Line 1: Line 1:
-**DroidScript Console** 
  
-Execute your droidscript commands directly from this app. 
-\\ 
-[[http://mycode.ucoz.net/files/spk/Console_v1.spk|Here]] is the spk. 
- 
-<code JavaScript Console.js> 
- 
-//Called when application is started. 
-function OnStart() 
-{ 
- //Create a layout with objects vertically centered. 
- lay = app.CreateLayout( "linear", "TopCenter,FillXY" );  
- 
- //Create a text label and add it to layout. 
- txt = app.CreateText( "Droidscript Console" ); 
- txt.SetTextSize( 20 ); 
- lay.AddChild( txt ); 
- //Create Text Edit 
- edt = app.CreateTextEdit("Start here: ",1,.96,"NoSpell" ) 
- edt.SetBackColor( "#000000" ); 
- edt.Focus(); 
- edt.SetTextSize(13 ); 
-        edt.SetOnEnter( clc ); 
- lay.AddChild(edt); 
- //Add layout to app.  
- app.AddLayout( lay ); 
-} 
- 
-function clc(){ 
-var t = edt.GetText() 
-var p = edt.GetCursorPos();; 
-try{ 
-//run() or app.Execute() 
-edt.SetText(t+"\n"+eval(t.slice(t.lastIndexOf(":")+1,t.length))+"\n"+"start here: " ); 
-edt.SetCursorPos(t.length ); 
-} 
-}catch(e){ 
-edt.SetText(t+"\n"+e+"\n"+"start here: " ); 
-edt.SetCursorPos(t.length ); 
- 
-} 
-} 
- 
-function run(fn) { 
-  return new Function 
-('return ' + fn)(); 
-} 
- 
-//Get properties and methods 
-function prop(objectname){ 
-this.s ="" 
-this.a =0 
- for(x in objectname){ 
-    this.a++ 
-    this.s+=a+" "+x+"\n\n"+objectname[x]+"\n\n\n\n" 
-   } 
-   return this.s 
-   } 
- 
-</code> 
- 
-[[:|Home]]>>[[sample_code:|Sample Code]]\\ 
sample_code/droidscript_console.txt ยท Last modified: 2016/10/31 05:41 (external edit)