Back

CreateYesNoDialog

Hello World
Content:
- Methods

The YesNo dialog can be used to let the user confirm a specific action.

ynd = app.CreateYesNoDialog( message, options ) → app object: YesNoDialog

Its the equivalent to the js confirm function, but it is more customizable. (and doesn't crash when aborting

Example - Basic

function OnStart()
{
ynd = app.CreateYesNoDialog( "Choose an answer" );
ynd.SetOnTouch( Ynd_OnTouch );
ynd.Show();
}

function Ynd_OnTouch( result )
{
    app.Alert( result, "Result" );
}
Copy All       Run      

Methods

The following methods are available on the YesNoDialog object:

GetType() → string: “YesNoDialog”
Hide()
Method( name, types, p1, p2, p3, p4 ) → all types
Show()
number
string
number: -180..180
number: -100..100
number: 0..100
string:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
string: path to file or folder ( “/absolute/...” or “relative/...” )
string: comma “,” separated: “NoDim”, “NoFocus”, “TouchModal”
string: “repeat”
string: “px” or “sp” or “dip” or “dp” or “mm” or “pt”
list: boolean,char,byte,short,int,long,float,double,String,CharSequence,...
function( result )
ynd.AdjustColor
Adjust the visual color effect of the control by setting the Hue (by angle in degrees in a color circle), the saturation, brightness and contrast of the control.
ynd.Dismiss
Hide the control and remove it from the screen.
ynd.GetType
Returns the control class name.
ynd.Hide
Hide the control but keep the layout space free.
ynd.Method
Allows access to other functions defined on the object in Java via reflection.

Note: This function is a premium feature. Please consider subscribing to Premium to use this feature and support DroidScript in its further development.
ynd.SetBackColor
Changes the background color of the control.
ynd.SetBackground
Changes the background to an image which can be repeated using the repeat option.
An image which is often used with that option is '/res/drawable/pattern_carbon' - try it out!
ynd.SetButtonText
Changes the texts of the two Yes/No buttons.
ynd.SetOnTouch
Define a callback function which is called when the user touches one of the buttons, passing either “Yes” or “No” to the callback function
ynd.SetSize
Change the size of the control in either screen relative values or in pixels if the px option was given.
ynd.Show
Set the visibility of the control to “Show”.