-
“Are you sure?”-box problem
Hi! I’m working with a new script where I really need a “Are you sure?” box so the user won’t do something stupid. The easiest way I found was to make a function with a new UI with the text “Are you sure?” and two buttons, yes and no, because I have to use this multiply times within my script.
The only problem I have now is how do I get the yes/no information to go out from my function and continue in the previous function that will execute what ever the user now wanted.
my “Are you sure?” function looks like this atm:
function areYouSure ()
{
var w = new Window("dialog", "Are you sure?", undefined);
w.orientation = "column";
var groupOne = w.add("group", undefined, "groupOne");
groupOne.add("statictext",undefined, "Are you sure?");var groupTwo = w.add("group", undefined, "groupTwo");
var buttonYes = groupTwo.add("button", undefined, "Yes");
var buttonNo = groupTwo.add("button", undefined, "No");buttonYes.onClick = function ()
{var areYouSureCheck = "yes"; w.hide();}buttonNo.onClick = function ()
{var areYouSureCheck = "no"; w.hide();}w.show();
}
I know a variables information can’t get out from a function, but I tried anyway and as logic said, it didn’t work.