Back

Spinner

Create Spinners using the CreateSpinner method of the app object:

 spin = app.CreateSpinner( list, width, height, options );

You can allow the Spinner to auto-size by leaving out the dimensions or you can specify a width and/or height as decimal fractions of the screen's width and height.

Use the SetOnChange method of your spinner to set the name of a function you want to be called when the user selects an item.

You can get the current selection of the Spinner button at any time using the GetText method and replace the option list at any time by using the SetList method.

Use the SelectItem method to select a particular item in code

Example

function OnStart()
{
    lay = app.CreateLayout( "Linear", "VCenter,FillXY" );

    spin = app.CreateSpinner( "Bilbo,Frodo,Gandalf", 0.4 );
    spin.SetOnChange( ShowSelection );
    spin.SelectItem( "Frodo" );
    lay.AddChild( spin );

    app.AddLayout( lay );
}

function ShowSelection( item )
{
    app.ShowPopup( "Selected = " + item );
}
    Copy     Copy All      Run     

See 'CreateSpinner for more informations and a complete function list