Back

CreateAlert

Hello World
Content:
- Methods

A nice pop-up at the top of your current layout.

alr = MUI.CreateAlert( text, icon, color ) → Object

Example - No icon

cfg.Light
cfg.MUI

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

    var text = "This is a sample text for the popup."
    alr = MUI.CreateAlert(text)
    alr.Show()
}
Copy All       Run      

Example - With icon

cfg.Light
cfg.MUI

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

    var text = "This is a sample text for the popup."
    alr = MUI.CreateAlert(text, "message")
    alr.Show()

    setTimeout(CloseAlert, 4000)
}

function CloseAlert()
{
    alr.Hide()
}
Copy All       Run      

Example - On close function

cfg.Dark
cfg.MUI

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

    var text = "This is a sample text for the popup."
    alr = MUI.CreateAlert(text, "message", MUI.colors.blue.darken2)
    alr.SetOnClose(AlertOnClose)
    alr.Show()
}

function AlertOnClose(val)
{
    if(val)
        app.ShowPopup("You close me!")
}
Copy All       Run      

Methods

The following methods are available on the Alert object:

Focus()
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
Gone()
Hide()
IsEnabled() → Boolean
IsOverlap( obj, depth ) → Boolean
IsVisible() → Boolean
Show()
app object
Number
String
Number: fraction (0..1)
String:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
String: “Popup text”
String: “Material icon”
String: “px”
String: “screen”, “px”
function( isBtnClick )
alr.ClearFocus
Removes the focus of the control so that the user no longer has immediate access to it.
alr.Focus
Set the focus to the control so that the user can interact with it immediately.
alr.GetAbsHeight
Get the absolute height of the control in pixels.
alr.GetAbsWidth
Get the absolute width of the control in pixels.
alr.GetHeight
Get the height of the control as screen height relative float or in pixels with the px option.
alr.GetLeft
Get the distance from the control to the left parent border as width relative float or in pixels with the px option.
alr.GetParent
Returns the parent control object where the object was added to - commonly a layout.
alr.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.
alr.GetTop
Get the distance from the control to the upper parent border as height relative float or in pixels with the px option.
alr.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
alr.GetWidth
Get the width of the control as screen width relative float or in pixels with the px option.
alr.Gone
Hides the control without consuming any more layout space as if it were never there.
alr.Hide
Hide the control but keep the layout space free.
alr.IsEnabled
Returns whether the control is currently useable by the user.
alr.IsOverlap
Returns whether the control overlaps with another by a given distance.
alr.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
alr.SetOnClose
Calls a function when alert is close
alr.SetText
Change the currently displayed text in the control.
alr.Show
Set the visibility of the control to “Show”.