Hi Jim,
Really thank you for the professional reply.
I make my code based on all your suggestions, but I find the problems about sequential execution (the JSL executes all the following codes even if I haven't clicked the "OK" yet).
So I have to put all my following code into Set Script to ensure the correct executive sequence.
There are 2 options crossing my mind,
1) Can this method be used in the <<modal? It seems <<modal can stop the JSL running till I click "OK".
2) Does wait(0) work here? and where I should put it among the code?
Here is my simplified code to show my problems, I mark 2 lines as blue to show what I have done,
Names Default To Here( 1 );
list = {"A", "B", "C", "D", "E", "F", "G"};
val = {};
nw = New Window( "example",
v = V List Box(),
Button Box( "OK",
Set Script(
nw << close window;
New Window( "result", <<modal, Text Box( val ) );
)
)
);
For( i = 1, i <= N Items( list ), i++,
Insert Into( val, 1 );
(v << append(
Outline Box( "",
H List Box(
Text Box( list[i] ),
Eval(
Substitute(
Expr(
exq = Number Edit Box(
1,
10,
<<SetFunction(
Function( {this},
val[i] = exq << get
)
)
)
),
Expr( exq ), Parse( "exq" || Char( i ) ),
Expr( i ), i,
)
),
)
)
) ; );
);
nw2 = New Window( "fake result", <<modal, Text Box( val ) );