Skip to content

Instantly share code, notes, and snippets.

@MotiurRahman
Last active December 12, 2019 15:10
Show Gist options
  • Save MotiurRahman/9c62e018f0bb552e61dff80fe83b51e5 to your computer and use it in GitHub Desktop.
Save MotiurRahman/9c62e018f0bb552e61dff80fe83b51e5 to your computer and use it in GitHub Desktop.
AlertDialog Test
var win = Ti.UI.createWindow({
title : 'AlertDialog Window',
backgroundColor : 'white',
exitOnClose : true,
fullscreen : false
});
// Create a Button.
var TestDialog = Ti.UI.createButton({
title : "TestDialog",
top : 400,
height : Ti.UI.SIZE,
width : Ti.UI.SIZE
});
var dialog = Ti.UI.createAlertDialog({
buttonNames : ['Confirm', 'Cancel', 'Help'],
message : 'Would you like to delete the file?',
title : 'Delete'
});
dialog.addEventListener("click", function(e) {
if (e.index === 0) {
alert("You Click Confirm");
} else if (e.index === 1) {
alert("You Click Cancel");
} else if (e.index===2) {
alert("You Click Help");
}
});
// Listen for click events.
TestDialog.addEventListener('click', function() {
dialog.show();
Ti.API.info("testing");
});
// Add to the parent view.
win.add(TestDialog);
win.open();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment