The YesNo dialog can be used to let the user confirm a specific action.
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" );
}
from native import app
def OnStart():
ynd = app.CreateYesNoDialog("Choose an answer")
ynd.SetOnTouch(Ynd_OnTouch)
ynd.Show()
def Ynd_OnTouch(result):
app.Alert(result, "Result")
Properties
The following properties are available on the YesNoDialog object:
Methods
The following methods are available on the YesNoDialog object:
all types
Number
String
Number: pixel
Number: -180..180
Number: -100..100
Number: 0..100
String:
hexadecimal: “#rrggbb”, “#aarrggbb”
colourName: “red”, “green”, ...
String: path to file ( “/absolute/...” or “relative/...” )
String: comma “,” separated: “NoDim”, “NoFocus”, “TouchModal”
String: comma “,” separated: “boolean”, “char”, “byte”, “short”, “int”, “long”, “float”, “double”, “String”, “CharSequence”, “...”
String: “repeat”
String: “px” or “sp” or “dip” or “dp” or “mm” or “pt”
Object: {
command:
args }
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.Batch
Batch method calls to be able to set all object's properties at once.
Note that you need to specify each parameter (use “” or null to leave some out)
Inherited methods can be called by appending an underscore to the function name (ie. txt.Batch({ SetBackColor_: [“red”] })
ynd.data
An object for saving individual extra properties.
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.MethodAllows 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”.