How can a single JSL have it pop up a dialog at runtime, and when I fill in the text, it can read the content and pass it to the variable and continue running?
Thanks!
for modal, just change the example:
ex = New Window( "Dialog() example", <<Modal, <<Return Result, V List Box( H List Box( "Set this value", variable = text Edit Box( "Change this text" ) ), H List Box( Button Box( "OK" ), Button Box( "Cancel" ) ) ) );<BR />// because the window is modal, the window must be closed before the following code runs If( ex["button"] == 1, // not canceled // then show the value write(ex["variable"] ), // note: variable is the name of the variable holding the text edit box<BR />// else report no selection write("CANCEL"); // cancel button or red X was pressed );
The example in the scripting index needs a small rewrite to be more useful. I've fixed the main problem and added comments above. The main problem is the if-clause in the example is a confusing double-statement with a semicolon.
edit: repair formatting (for some reason, the code formatter wants to mess up the final else statement)
Here's a working example. You need to include << modal, assign a variable to the text edit box, and retrieve the text edit box value before the user exits the modal dialog.
dt = Open( "$SAMPLE_DATA/Big Class.jmp" ); ex = New Window( "Example: Text Edit Box", << modal, panel Box( "Picker Example", H List Box( Text Box( "Label:" ), teb = Text Edit Box() ) ), panel box("Options", h list box( ok_button = button box("OK", na = teb << get text), canc_button = button box("Cancel", na = "") ) ) ); show(na); // Wait for me to input text "JANE" dt << Select Where( :name == uppercase(na) ); d3 = dt << Subset( Output Table( "tmp" ), Selected Rows( 1 ), selected columns( 0 ) );
you need the modal option.
A modal window waits for a response; you can't do anything else until it closes.
What I want to fill in is not a number, how to modify?
Thank Craige!
A text edit box, rather than a num edit box.
Also, take a look at Modal Dialogs , especially how to get the answers from the modal dialog.
How can variable "a1" get the "efg" I filled in?
Thanks Experts!