Back

DatePickerDialog

Create DatePickerDialog objects using the CreateDatePickerDialog method of the UIExtras object:

 picker = uix.CreateDatePickerDialog( title, year, month, day, options );

By default the DatePickerDialog will use a spinner view, you can use the Calendar option to use a calendar view instead.

Example - DatePickerDialog

app.LoadPlugin( "UIExtras" );

function OnStart()
{
 lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 
 btn = app.CreateButton( "Pick Date", 0.3, 0.1 );
 btn.SetOnTouch( btn_OnTouch );
 lay.AddChild( btn );

 app.AddLayout( lay );

 uix = app.CreateUIExtras();
}

function btn_OnTouch()
{
 picker = uix.CreateDatePickerDialog( "Pick a Date" );
 picker.SetOnOk( picker_OnOk );
 picker.Show();
}

function picker_OnOk( year, month, day )
{
 var date = new Date();
 date.setFullYear( year, month, day);

 app.ShowPopup( date.toDateString() );
}
  Copy   Copy All    Run   

The following methods are available on the DatePickerDialog object:

 GetType()
 SetTitle( title )
 Show()
 Hide()
 Dismiss()
 SetDate( year, month, day )
 SetMinDate( year, month, day )
 SetMaxDate( year, month, day )
 SetOnOk( callback )