This shows you the differences between two versions of the page.
sample_code:search [2018/09/12 20:17] 77.125.22.166 |
sample_code:search [2018/09/13 14:50] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | =====Example===== | ||
- | //(Example taken from the DroidScript sample section)// | ||
- | <code javascript> | ||
- | btn = []; | ||
- | word = 0; | ||
- | //Called when application is started. | ||
- | function OnStart() | ||
- | { | ||
- | //Create a layout with objects vertically centered. | ||
- | lay = app.CreateLayout( " | ||
- | edt = app.CreateTextEdit( "", | ||
- | edt.SetOnEnter( surch ); | ||
- | lay.AddChild( edt ); | ||
- | | ||
- | for(i = 0; | ||
- | { | ||
- | btn[i] = app.CreateButton( word ); | ||
- | word++; | ||
- | } | ||
- | | ||
- | //Add layout to app. | ||
- | app.AddLayout( lay ); | ||
- | } | ||
- | |||
- | function surch () | ||
- | { | ||
- | for( var s = 0 ; s <= 150 ; s++ ){ | ||
- | if (edt.GetText() == btn[s].GetText()) | ||
- | { | ||
- | | ||
- | |||
- | | ||
- | } | ||
- | } | ||
- | } | ||
- | </ |