Mickyboy,
If I entered 3, show(Headstart) returns the list {variablebox = 3, Button( 1 )}. Except for the Button, every other item in the list is an assignment.
Here are two ways to get the values from a modal dialog, <<Return Result,
- listname["boxname"] so Headstart[ "variablebox" ] returns 3.
- If the button is 1, remove the last item in the list, and eval list(listname), then each assignment is executed and you can refer to the variablebox name.
Below is an excerpt from script 7_SimpleModalDialog.jsl, one of the scripts written for JSL Companion, Applications of the JMP Scripting Language, 2nd edition. The first show statement uses the syntax #2 and the second show is teh syntax you can use after you remove the button and eval list().
There are additional methods as well.
So for your example, you can use
Headers Start on Row( Headstart["variablebox"] )
or use code similar to the example below.
Names Default to here(1);
usr_info = New Window("Query", << Modal, <<Return Result,
Text Box("Select the query filters"),
HListBox(
LineupBox(NCol(2),
TextBox("Number of days, 30 day maximum"), ndays = numberEditBox(7),
TextBox("Parameter name, wildcard=* "), param = textEditBox(),
TextBox("Manufacturing Step Id"), step_id = numberEditBox()
), //end LineupBox
LineupBox( NCol(1), ButtonBox("OK"), ButtonBox("Cancel"))
) //end HListBox
);
show(usr_info, usr_info[ "ndays" ], usr_info["param"],
usr_info["step_id"], usr_info["Button"] );
//Review chapter 5 on Lists and Assignment Lists. This output is an assignment list, except for Button()
//Usage: usr_info["ndays"] contains user repsonse or Check for OK , remove button and Eval List
If(usr_info["Button"]== -1,
Caption("Aborting..."); Wait(3); Caption(Remove); Throw());
StatusMsg("Processing next steps");
RemoveFrom(usr_info, NItems(usr_info)); //Remove the last item "Button(1)"
Eval List(usr_info); //Assignments are run
Show( usr_info, ndays, param, step_id);