Back

CreateBanner

Hello World
Content:
- Methods

A banner dialog is a nice popup that slides from the top of your current page.

bnr = MUI.CreateBanner( text, okText, cancelText ) → Object

Example - Light

cfg.Light
cfg.MUI

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

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

    ban = MUI.CreateBanner("There is no internet connection at the moment.", "LEARN MORE", "CLOSE")
    ban.Show()
}
Copy All       Run      

Example - Dark

cfg.Dark
cfg.MUI

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

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

    ban = MUI.CreateBanner("There is no internet connection at the moment.", "LEARN MORE", "CLOSE")
    ban.SetOnTouch(OnTouch)
    ban.Show()
}

function OnTouch(v)
{
    if(v)
        app.ShowPopup("Learn more")
    else
        app.ShowPopup("Banner close")
}
Copy All       Run      

Methods

The following methods are available on the Banner 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()
Boolean
app object
Number
String
Number: fraction (0..1)
String:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
String: html code
String: “Truthy button text”
String: “Falsey button text”
String: “px”
String: “screen”, “px”
String: “px” or “dip” or “sp” or “mm” or “pt” or pl or ps
String: “Show” or “Hide” or “Gone”
function()
function( isOkBtnClick, btnText )
bnr.ClearFocus
Removes the focus of the control so that the user no longer has immediate access to it.
bnr.Focus
Set the focus to the control so that the user can interact with it immediately.
bnr.GetAbsHeight
Get the absolute height of the control in pixels.
bnr.GetAbsWidth
Get the absolute width of the control in pixels.
bnr.GetHeight
Get the height of the control as screen height relative float or in pixels with the px option.
bnr.GetLeft
Get the distance from the control to the left parent border as width relative float or in pixels with the px option.
bnr.GetParent
Returns the parent control object where the object was added to - commonly a layout.
bnr.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.
bnr.GetTop
Get the distance from the control to the upper parent border as height relative float or in pixels with the px option.
bnr.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
bnr.GetWidth
Get the width of the control as screen width relative float or in pixels with the px option.
bnr.Gone
Hides the control without consuming any more layout space as if it were never there.
bnr.Hide
Hide the control but keep the layout space free.
bnr.IsEnabled
Returns whether the control is currently useable by the user.
bnr.IsOverlap
Returns whether the control overlaps with another by a given distance.
bnr.IsVisible
Returns whether the control is currently visible to the user, ignoring overlaying controls.
bnr.SetEnabled
En/Disable the control physically and visually so that the user can/can not access the control. Events like OnTouch will still be fired.
bnr.SetHtml
Change the current text of the control to html-formatted text.
bnr.SetOnClose
Define a callback to be called when the dialog of control is closed.
bnr.SetOnTouch
Calls a function when buttons are click (prev. SetOnTouchOK)
bnr.SetText
Change the currently displayed text in the control.
bnr.SetTextColor
Change the text color of the contained text.
bnr.SetTextSize
Change the size of the contained text.
bnr.SetVisibility
Change the visibility of the control to one of the available modes:
Show: visible
Hide: invisible but still consuming space
Gone: invisible and not consuming space
bnr.Show
Set the visibility of the control to “Show”.