Back

CreateTimePicker

Hello World
Content:
- Methods

Creates a material design time picker.

tmp = MUI.CreateTimePicker( hour, minute, color ) → Object

Example - Default Time

cfg.Light
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "FillXY,VCenter")

        btn = MUI.CreateButtonRaised("SHOW PICKER")
        btn.SetOnTouch(ShowPicker)
        lay.AddChild(btn)

    app.AddLayout(lay)

    tmp = MUI.CreateTimePicker()
    tmp.SetOnSelect(OnSelect)
}

function ShowPicker()
{
    tmp.Show()
}

function OnSelect(time, hh, mm, pos)
{
    app.ShowPopup(hh+":"+mm+":"+pos)
}
Copy All       Run      

Example - Custom Time

cfg.Dark
cfg.MUI

function OnStart()
{
    color = MUI.colors.teal
    app.InitializeUIKit(color.teal)

    lay = MUI.CreateLayout("Linear", "FillXY,VCenter")

        btn = MUI.CreateButtonRaised("SHOW PICKER")
        btn.SetOnTouch(ShowPicker)
        lay.AddChild(btn)

    app.AddLayout(lay)

    tmp = MUI.CreateTimePicker(13, 24, MUI.colors.deepOrange.deepOrange)
    tmp.SetOnSelect(OnSelect)
}

function ShowPicker()
{
    tmp.Show()
}

function OnSelect(time, hh, mm, pos)
{
    app.ShowPopup(hh+":"+mm+":"+pos)
}
Copy All       Run      

Methods

The following methods are available on the TimePicker object:

GetAbsHeight() → Number: integer
GetAbsWidth() → Number: integer
GetHeight( options ) → Number
GetLeft( options ) → Number
GetParent() → app object
GetPosition( options ) → Object: { left, top, right, bottom }
GetTop( options ) → Number
GetVisibility() → String: “Show” or “Hide” or “Gone”
GetWidth( options ) → Number
Hide()
IsEnabled() → Boolean
IsOverlap( obj, depth ) → Boolean
IsVisible() → Boolean
Show()
app object
Number
Number: fraction (0..1)
Number: [0-24]
Number: 0-59
String:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
String: “px”
String: “screen”, “px”
Object: An MUI TextEdit control
function( hh:mm AM|PM, hour, minute, pos )
tmp.GetAbsHeight
Get the absolute height of the control in pixels.
tmp.GetAbsWidth
Get the absolute width of the control in pixels.
tmp.GetHeight
Get the height of the control as screen height relative float or in pixels with the px option.
tmp.GetLeft
Get the distance from the control to the left parent border as width relative float or in pixels with the px option.
tmp.GetParent
Returns the parent control object where the object was added to - commonly a layout.
tmp.GetPosition
Returns data about the position and size of the control.
If the screen option is given the position on the screen will be returned. Otherwise relative to the parent control.
The px options turns the relative values into pixels.
tmp.GetTop
Get the distance from the control to the upper parent border as height relative float or in pixels with the px option.
tmp.GetVisibility
Returns the current visibility state of the control. The Values are:
Show: visible
Hide: invisible but still consuming space
Gone: invisible and not consuming space
tmp.GetWidth
Get the width of the control as screen width relative float or in pixels with the px option.
tmp.Hide
Hide the control but keep the layout space free.
tmp.IsEnabled
Returns whether the control is currently useable by the user.
tmp.IsOverlap
Returns whether the control overlaps with another by a given distance.
tmp.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
tmp.SetOnSelect
Calls a function when the user selects a time.
tmp.SetTextEdit
Pass texedit control to display input values
tmp.Show
Set the visibility of the control to “Show”.