There are a couple of ways to control non-modal windows behavior:
1. Put the tasks that you want the OK button to accomplish into an expression earlier in the code. Then, when the user clicks OK just provide the expression.
ok_expr = expr(
user_input = user_teb << get text();
print("User entered " || user_input);
mywin << close window;
);
user_input = "";
mywin = new window("Get User Input",
hlistbox(
text box("Enter some text: "),
user_teb = text edit box(),
),
button box("OK", ok_expr),
button box("Cancel", mywin << close window;),
);
2. Put the OK tasks into a separate JSL file and use the include() statement to run the desired commands:
// ok_commands.jsl
user_input = user_teb << get text();
print("User entered " || user_input);
mywin << close window;
// Here are the dialog box commands, in a separate file
user_input = "";
mywin = new window("Get User Input",
hlistbox(
text box("Enter some text: "),
user_teb = text edit box(),
),
button box("OK", include("ok_commands.jsl");),
button box("Cancel", mywin << close window;),
);