Content:
- Styling
- Methods

Buttons created with the CreateButton method are used for interacting with the app.

btn = app.CreateButton( text, width, height, options ) → app object: Button

This is done by calling a callback function after clicking on the button. You can specify such a callback function with the SetOnTouch Method:

btn.SetOnTouch( btn_OnTouch );

function btn_OnTouch()
{
// your OnTouch code goes here
}

Styling

You can allow the button to auto-size by leaving out the dimensions

Example - Default Size click to expand contents 

or you can specify a width and height as decimal fractions.

Example - Fixed Size click to expand contents 

Setting the width and height to -1 whilst using the “FillX” option will allow it to fill the layout width.

Example - Fill Layout Width click to expand contents 

You can customize the visual look in many ways by either using one of the existing style options “Alum” or “Gray”, or you can use “Custom” and define a custom style with the SetStyle method.

Example - Change Style click to expand contents 

Methods

The following methods are available on the Button object:

Focus()
GetAbsHeight() → Number: integer
GetAbsWidth() → Number: integer
GetHeight( options ) → Number
GetLeft( options ) → Number
GetParent() → app object
GetPosition( options ) → Object: { left, top, width, height }
GetText() → String
GetTextSize( mode ) → Number
GetTop( options ) → Number
GetType() → String: “Button”
GetVisibility() → String: “Show” or “Hide” or “Gone”
GetWidth( options ) → Number
Gone()
Hide()
IsEnabled() → Boolean
IsOverlap( obj, depth ) → Boolean
IsVisible() → Boolean
Method( name, types, p1, p2, p3, p4 ) → all types
SetScale( x, y )
Show()