This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:nxt_isconnected [2015/03/10 21:00] madlyr |
built_in:nxt_isconnected [2015/03/11 18:03] (current) |
||
---|---|---|---|
Line 6: | Line 6: | ||
====Example - IsConnected Connect / Disconnect to NXT with FontAwesome icons==== | ====Example - IsConnected Connect / Disconnect to NXT with FontAwesome icons==== | ||
<file javascript NxtConnect.js> | <file javascript NxtConnect.js> | ||
- | var nxt, lay; | + | var nxt, lay, btnConnect; |
function OnStart() | function OnStart() | ||
{ | { | ||
lay = app.CreateLayout( " | lay = app.CreateLayout( " | ||
- | |||
//Create Connect button. | //Create Connect button. | ||
btnConnect = app.CreateButton( " | btnConnect = app.CreateButton( " | ||
Line 17: | Line 16: | ||
btnConnect.SetOnTouch( btnConnect_OnTouch ); | btnConnect.SetOnTouch( btnConnect_OnTouch ); | ||
lay.AddChild( btnConnect ); | lay.AddChild( btnConnect ); | ||
- | |||
app.AddLayout( lay ); | app.AddLayout( lay ); | ||
Line 28: | Line 26: | ||
if (nxt.IsConnected()) { | if (nxt.IsConnected()) { | ||
btnConnect.SetText(" | btnConnect.SetText(" | ||
- | app.ShowPopup( " | + | app.ShowPopup(" |
} | } | ||
} | } |