Back

CreateColorPicker

Hello World
Content:
- Methods

Creates a color picker dialog where you can select a range of MUI predefined colors.

clp = MUI.CreateColorPicker( title ) → Object

Example - Light

cfg.Light
cfg.MUI

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

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

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

    app.AddLayout(lay)

    clr = MUI.CreateColorPicker("Choose Color")
    clr.SetOnSelect(OnSelect)
}

function ShowPicker()
{
    clr.Show()
}

function OnSelect(color)
{
    app.ShowPopup(color)
}
Copy All       Run      

Example - Dark

cfg.Dark
cfg.MUI

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

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

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

    app.AddLayout(lay)

    clr = MUI.CreateColorPicker("Choose Color")
    clr.SetOnSelect(OnSelect)
}

function ShowPicker()
{
    clr.Show()
}

function OnSelect(color)
{
    app.ShowPopup(color)
}
Copy All       Run      

Methods

The following methods are available on the ColorPicker 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
String
Number: fraction (0..1)
String: “px”
String: “screen”, “px”
Object: An MUI TextEdit control
function( color )
clp.GetAbsHeight
Get the absolute height of the control in pixels.
clp.GetAbsWidth
Get the absolute width of the control in pixels.
clp.GetHeight
Get the height of the control as screen height relative float or in pixels with the px option.
clp.GetLeft
Get the distance from the control to the left parent border as width relative float or in pixels with the px option.
clp.GetParent
Returns the parent control object where the object was added to - commonly a layout.
clp.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.
clp.GetTop
Get the distance from the control to the upper parent border as height relative float or in pixels with the px option.
clp.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
clp.GetWidth
Get the width of the control as screen width relative float or in pixels with the px option.
clp.Hide
Hide the control but keep the layout space free.
clp.IsEnabled
Returns whether the control is currently useable by the user.
clp.IsOverlap
Returns whether the control overlaps with another by a given distance.
clp.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
clp.SetOnSelect
Calls a function when a user click the OK button
clp.SetTextEdit
Pass texedit control to display input values
clp.Show
Set the visibility of the control to “Show”.