Copy link to clipboard
Copied
My problem is the following
I would like the scipt to work like this:
if I click first on checkbox 3 then 2 and then 1
when I click ok it must have this sequence 3 - 2 - 1
instead it returns me 1 - 2 - 3
or if I click first on checkbox 2 then 3 and then 1
when I click ok it must have this sequence 2 - 3 - 1
instead it returns me 1 - 2 - 3
I can not figure out how to solve this problem
does anyone have a solution?
win = new Window("dialog", "test");
win.orientation = "column";
test = win.add("group");
ActionButton = test.add("group");
Action_1 = ActionButton.add("checkbox", undefined, "1");
Action_1.minimumSize.width = 20;
Action_2 = ActionButton.add("checkbox", undefined, "2");
Action_2.minimumSize.width = 20;
Action_3 = ActionButton.add("checkbox", undefined, "3");
Action_3.minimumSize.width = 20;
test.orientation = "column";
closeBtn = test.add("button", undefined, "OK");
closeBtn.onClick = function () {
if(Action_1.value) {
alert("test 1");
}
if(Action_2.value) {
alert("test 2");
}
if(Action_3.value) {
alert("test 3");
}
close = true;
win.close();
};
win.show();
In my opinion SuperMerlin gave the right decision.
Just change your function to this
closeBtn.onClick = function ()
{
for (var i = 0; i < arr1.length; i++)
{
switch(arr1)
{
case 1: alert("test 1"); break;
case 2: alert("test 2"); break;
case 3: alert("test 3"); break;
}
}
}
Copy link to clipboard
Copied
You could do something like...
win = new Window("dialog", "test");
var arr1 =[0,0,0];
win.orientation = "column";
test = win.add("group");
ActionButton = test.add("group");
Action_1 = ActionButton.add("checkbox", undefined, "1");
Action_1.minimumSize.width = 20;
Action_1.onClick=function(){
if(Action_1.value){
arr1.push(1);
arr1.shift();
}
}
Action_2 = ActionButton.add("checkbox", undefined, "2");
Action_2.minimumSize.width = 20;
Action_2.onClick=function(){
if(Action_2.value){
arr1.push(2);
arr1.shift();
}
}
Action_3 = ActionButton.add("checkbox", undefined, "3");
Action_3.minimumSize.width = 20;
Action_3.onClick=function(){
if(Action_3.value){
arr1.push(3);
arr1.shift();
}
}
closeBtn = test.add("button", undefined, "OK");
closeBtn.onClick = function () {
alert(arr1.toString());
win.close();
};
win.show();
Copy link to clipboard
Copied
SuperMerlin
thanks for the ride
but that's not exactly what I'm looking for
I do not want this window to come out
I want that after I click OK
they come out in sequence
the test window 3
and test window 1.
Copy link to clipboard
Copied
Checkboxs have a value of true or false.
So what you want can not be done.
Copy link to clipboard
Copied
I imagined it could not be done
thanks SuperMerlin
Copy link to clipboard
Copied
In my opinion SuperMerlin gave the right decision.
Just change your function to this
closeBtn.onClick = function ()
{
for (var i = 0; i < arr1.length; i++)
{
switch(arr1)
{
case 1: alert("test 1"); break;
case 2: alert("test 2"); break;
case 3: alert("test 3"); break;
}
}
}
Copy link to clipboard
Copied
r-bin
perfect
thank you so much
Now who should I give the correct answer?
Copy link to clipboard
Copied
Please mark r-bin​ as the correct answer.