Back

addTimePicker

JS Py
Hello World
Content:
- Properties
- Methods

Adds a time picker component to the app.

tpk = ui.addTimePicker( time, options ) → Object: TimePicker Component

Properties

These are the setter and getter properties for the addTimePicker Component.

Example - Basic

class Main extends App
{
    onStart()
    {
        // Creates a layout with objects verticaly centered.
        this.main = ui.addLayout( "main", "Linear", "VCenter,ScrollY", 1, 1 )

        // button to show time picker
        this.btn = ui.addButton( this.main, "Show Time Picker", "Outlined,Secondary", 0.2 )
        this.btn.setOnTouch( this.showTimePicker )

        // Initialize time picker
        this.tpk = ui.addTimePicker()
        this.tpk.setOnSelect( this.onSelect )
    }

    showTimePicker()
    {
        // show time picker dialog
        this.tpk.show()
    }

    onSelect( value )
    {
        console.log( value )
    }
}
from hybrid import ui

def OnStart():
    global tpk
    main = ui.addLayout("main", "Linear", "VCenter,ScrollY", 1, 1)
    btn = ui.addButton(main, "Show Time Picker", "Outlined,Secondary", 0.2)
    btn.setOnTouch(showTimePicker)
    tpk = ui.addTimePicker()
    tpk.setOnSelect(onSelect)

def showTimePicker(event):
    tpk.show()

def onSelect(value):
    print(value)
Copy All       Run      

Methods

The following methods are available on the TimePicker object:

show( callback, format ) → Boolean
String: “A default time value to which the timepicker begins. Value is of the form `HH
String: comma “,” separated: “`Portrait` `24H` `12H`”
String: “A time format. Can be of the form
Hour formats
`H` : 0 1 ... 22 23
`HH` :     00 01 ... 22 23
`h` : 1 2 ... 11 12
`hh` :     01 02 ... 11 12
Minute formats
`m` :     0 1 ... 58 59
`mm` : 00 01 ... 58 59
AM/PM
`A` : AM or PM
`a` : am pm”
String: Sets or returns the time format. Can be of the form
Hour formats
H : 0 1 ... 22 23
HH :     00 01 ... 22 23
h : 1 2 ... 11 12
hh :     01 02 ... 11 12
Minute formats
m :     0 1 ... 58 59
mm : 00 01 ... 58 59
AM/PM
A : AM or PM
a : am pm
function( value )
tpk.show
Show the date picker the dialog

Hide the date picker dialog

Sets a callback function to execute when date picker dialog is submitted

Sets the format of the date to be passed into the onSelect callback

Get the current visibility of the date picker