Dialog creates Dialog object that allows user to create custom dialog boxes which pop up and used to display temporary information or collect data from user.
Example - Example
function OnStart()
{
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
btn = app.CreateButton( "Show Dialog", 0.6, 0.1 );
btn.SetOnTouch( btn_OnTouch );
lay.AddChild( btn );
app.AddLayout( lay );
}
function btn_OnTouch()
{
dlg = app.CreateDialog( "Custom Dialog" );
layDlg = app.CreateLayout( "linear", "VCenter,FillXY" );
layDlg.SetSize( 0.7, 0.3 );
dlg.AddLayout( layDlg );
chk = app.CreateCheckBox( "Check Box" );
chk.SetMargins( 0, 0.02, 0, 0.02 );
layDlg.AddChild( chk );
btnDlg = app.CreateButton( "Close Dialog", 0.6, 0.1 );
btnDlg.SetOnTouch( btnDlg_OnTouch );
layDlg.AddChild( btnDlg );
dlg.Show();
}
function btnDlg_OnTouch()
{
dlg.Dismiss();
}
The following methods are avaiable on the Dialog object:
GetPosition(
options ) ->
object - { left: fraction of parent width, top: fraction of parent height, right: fraction of parent width, bottom: fraction of parent height }
string
string - "NoCancel" or "NoTitle" or "AutoCancel" or "NoFocus" or "NoDim"
app object - app layout
AddLayout
number
set color effects
?
destroys object
hide dialog
boolean
EnableBackKey
destroys object with explode animation and sound
?
get height in pixels
get width in pixels
unknown
get screen relative height
get distance to left parent border
get distance to upper parent border
GetVisibility
get screen relative width
Set visibility "Gone"
Set visibility "Hide"
IsEnabled
app object
number - fraction of screen width
return wether obj overlap with an other
IsVisible
?
RemoveLayout
string -
hexadecimal: "#rrggbb", "#aarrggbb"
colourName: "red", "green", ...
SetBackColor
number - fraction of screen height
SetBackColorRadial
string - path to file or folder ( "/absolute/..." or "relative/..." )
changes the background image
string - "Add" or "Multiply" or "?"
adjust color
en/disable object
move object from current position
function()
called when device's back button pressed
function()
valled when dialog was cancelled
called when user touches object
set surrounding borders
SetPosition
number - factor
SetScale
change object size
SetTitle
string - "Show" or "Hide" or "Gone"
change visibility mode
Set visibility "Show"
?
object id
{
source:
app object,
action:
string - "Down" or "Move" or "Up",
count:
number - integer,
X:
number - fraction of screen width,
Y:
number - fraction of screen height,
x:
list - [
x1,
x2,
x3 ],
y:
list - [
y1,
y2,
y3 ]
}