This shows you the differences between two versions of the page.
sample_code:droidscript_console [2016/08/29 06:18] titus |
sample_code:droidscript_console [2016/10/31 05:41] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | **DroidScript Console** | ||
- | Execute your droidscript commands directly from this app. | ||
- | |||
- | <code JavaScript> | ||
- | |||
- | //Called when application is started. | ||
- | function OnStart() | ||
- | { | ||
- | //Create a layout with objects vertically centered. | ||
- | lay = app.CreateLayout( " | ||
- | |||
- | //Create a text label and add it to layout. | ||
- | txt = app.CreateText( " | ||
- | txt.SetTextSize( 20 ); | ||
- | lay.AddChild( txt ); | ||
- | //Create Text Edit | ||
- | edt = app.CreateTextEdit(" | ||
- | edt.SetBackColor( "# | ||
- | 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{ | ||
- | edt.SetText(t+" | ||
- | edt.SetCursorPos(t.length ); | ||
- | } | ||
- | }catch(e){ | ||
- | edt.SetText(t+" | ||
- | edt.SetCursorPos(t.length ); | ||
- | |||
- | } | ||
- | } | ||
- | |||
- | function run(fn) { | ||
- | return new Function | ||
- | (' | ||
- | } | ||
- | |||
- | //Get properties and methods | ||
- | function prop(objectname){ | ||
- | this.s ="" | ||
- | this.a =0 | ||
- | for(x in objectname){ | ||
- | this.a++ | ||
- | this.s+=a+" | ||
- | } | ||
- | | ||
- | } | ||
- | |||
- | </ | ||
- | |||
- | [[: |