cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
ARETI052
Level II

Check box won't show up in an input prompt input

// New dialog for script selection
scripts = {"Box Plot", "Box Plot_sublot_trend", "Box Plot_duration_trend", "Box Plot_FT1vsFT2", "Tabulation", "CDF&PDF11"};
scriptSelections = J(1, N Items(scripts), 0);

// Initialize the checkboxes array
cb = {};

nw2 = New Window("Script Selection", <<modal,
    <<onClose(
        For(i = 1, i <= N Items(scripts), i++,
            scriptSelections[i] = cb[i] << Get;
        );
    ),
    VListBox(
        Text Box("Select the scripts to run:"),
        Panel Box("Scripts",
            V List Box(
                For(i = 1, i <= N Items(scripts), i++,
                    cb[i] = Check Box(scripts[i], 0);
                )
            )
        ),
        HListBox(
            Button Box("OK", nw2 << Close(1)),
            Spacer Box(size(6, 0)),
            Button Box("Cancel", nw2 << Close(0))
        )
    )
);

if (nw2["Button"] == -1, throw());

selectedScripts = {};

For(i = 1, i <= N Items(scripts), i++,
    If(scriptSelections[i] == 1,
        Insert Into(selectedScripts, scripts[i]);
    );
);

New Window("My report",
    VListBox(
        MyGraph(::yColName, ::xColName, ::xGroupName)
    )
);

// Include selected scripts
For(i = 1, i <= N Items(selectedScripts), i++,
    Include(selectedScripts[i] || ".jsl");
);

So I have several sub scripts for my main script to call, I wanted to create a checkbox where the user can select which sub scripts to run (from Box Plot", "Box Plot_sublot_trend", "Box Plot_duration_trend", "Box Plot_FT1vsFT2", "Tabulation", "CDF&PDF11.) But no matter what I do I only get an empty window with the line " Select Scripts to run".

How can I solve this? Thanks!

1 REPLY 1
jthi
Super User

Re: Check box won't show up in an input prompt input

There is no need to use For loop with check boxes. Display Functions (jmp.com) and Construct Display Boxes for New Windows (jmp.com)

 

This might not be exactly correct but gives an idea how to use checkboxes

 

Names Default To Here(1);
// New dialog for script selection
scripts = {"Box Plot", "Box Plot_sublot_trend", "Box Plot_duration_trend", "Box Plot_FT1vsFT2",
"Tabulation", "CDF&PDF11"};
scriptSelections = J(1, N Items(scripts), 0);

// Initialize the checkboxes array
cb = {};

nw2 = New Window("Script Selection",
	<<modal,
	V List Box(
		Text Box("Select the scripts to run:"),
		Panel Box("Scripts",
			cb = Check Box(scripts)
		),
		H List Box(
			Button Box("OK", cb << get selected),
			Spacer Box(size(6, 0)),
			Button Box("Cancel")
		)
	)
);

If(nw2["Button"] == -1,
	Throw()
);

selectedScripts = {};

For(i = 1, i <= N Items(scripts), i++,
	If(scriptSelections[i] == 1,
		Insert Into(selectedScripts, scripts[i])
	)
);

New Window("My report", V List Box(MyGraph(::yColName, ::xColName, ::xGroupName)));

// Include selected scripts
For(i = 1, i <= N Items(selectedScripts), i++,
	Include(selectedScripts[i] || ".jsl")
);

Also do not use << close window on modal window, you will run into all sorts of issues.

 

-Jarmo