Back

TimePicker

Create TimePicker objects using the CreateTimePicker method of the UIExtras object:

 picker = uix.CreateTimePicker( hour, minute, options );

By default the TimePicker will use 12 hour (AM/PM) format, you can use the 24Hour option to use a 24 hour format instead.

Example - TimePicker AM/PM

app.LoadPlugin( "UIExtras" );

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

 uix = app.CreateUIExtras();
 
 picker = uix.CreateTimePicker();
 picker.SetOnTimeChanged( OnTimeChanged );
 lay.AddChild (picker );
 
 app.AddLayout( lay );
}

function OnTimeChanged( hour, minute )
{
 app.ShowPopup( hour + ":" + minute);
}
  Copy   Copy All    Run   

Example - TimePicker 24 Hour

app.LoadPlugin( "UIExtras" );

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

 uix = app.CreateUIExtras();
 
 picker = uix.CreateTimePicker( 14, 30, "24Hour" );
 picker.SetOnTimeChanged( OnTimeChanged );
 lay.AddChild (picker );
 
 app.AddLayout( lay );
}

function OnTimeChanged( hour, minute )
{
 app.ShowPopup( hour + ":" + minute);
}
  Copy   Copy All    Run   

The following methods are available on the TimePicker object:

 GetType()
 SetTime( hour, minute )
 SetOnTimeChanged( callback )