Skip to content

Instantly share code, notes, and snippets.

@AlexeyNik
Created October 15, 2019 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AlexeyNik/1811ecf133f128bc9cc8edfef095cbe3 to your computer and use it in GitHub Desktop.
Save AlexeyNik/1811ecf133f128bc9cc8edfef095cbe3 to your computer and use it in GitHub Desktop.
customAlert('Hello', 3, 'This is a test - Will close in 3 seconds')
customAlert('Hello', 0, 'This is a test - Will not close automatically')
function customAlert(message, delaySeconds, title){
title = title || 'Alert';
var alertWindow = new Window('palette', title);
var control_text = alertWindow.add('edittext', [0, 0, 500, 200], message, {multiline: true});
if(delaySeconds == 0){
var control_close = alertWindow.add('button', undefined, 'Close');
control_close.onClick = function(){
if(alertWindow){
alertWindow.hide();
}
};
}
alertWindow.show();
alertWindow.update();
if(delaySeconds > 0){
$.sleep(delaySeconds * 1000);
alertWindow.hide();
alertWindow = null;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment