cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Hegedus
Level IV

How to Set a Check Box to default on?

Hi,

 

I am building a simple interface for the user and have a window to set some options using check boxes.  I would like to have the boxes checked by default.  How is this done.  The manual mentions a depreciated dialog box that allows setting of a default and recommends using modal window instead.  There appears to be no straightforward method described in the manual to achieve same functionality.

 

How should it be done?

 

Andy

New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
	Text Box("Set Preferences"),
	Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
	spacer box(size(200,20)), 
 
 Hlistbox(2, 
	Button Box( "OK",
		RV=Pref<<get(1);
		RD=Pref<<get(2);
		GR=Pref<<get(3);

	),
	Button Box( "Cancel",
		stop();
	)
	))
);

 

1 ACCEPTED SOLUTION

Accepted Solutions
txnelson
Super User

Re: How to Set a Check Box to default on?

Here is an example setting your first check box to being on

New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
	Text Box("Set Preferences"),
	Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
	spacer box(size(200,20)), 
	pref<<set(1,1);
 
 Hlistbox(2, 
	Button Box( "OK",
		RV=Pref<<get(1);
		RD=Pref<<get(2);
		GR=Pref<<get(3);

	),
	Button Box( "Cancel",
		stop();
	)
	))
);
Jim

View solution in original post

8 REPLIES 8
txnelson
Super User

Re: How to Set a Check Box to default on?

Here is an example setting your first check box to being on

New Window( "Input Required", <<Modal,
VlistBox(align("Center"),
	Text Box("Set Preferences"),
	Pref =Check Box({"Remove Single Value","Remove Duplicates","Group by Name"},1),
	spacer box(size(200,20)), 
	pref<<set(1,1);
 
 Hlistbox(2, 
	Button Box( "OK",
		RV=Pref<<get(1);
		RD=Pref<<get(2);
		GR=Pref<<get(3);

	),
	Button Box( "Cancel",
		stop();
	)
	))
);
Jim
Hegedus
Level IV

Re: How to Set a Check Box to default on?

Thank you,.

I would suggest you add some verbiage to the manual to explain this.
txnelson
Super User

Re: How to Set a Check Box to default on?

You need to add this request to the JMP Wish List.  I, like you, am just a JMP user, not an employee for JMP.

Jim

Re: How to Set a Check Box to default on?

There is already a solution in the scripting guide, by the way:

 

Capture.PNG

Hegedus
Level IV

Re: How to Set a Check Box to default on?

I am using JMP 12 and I did a search of the scripting guide and your example was not found. Perhaps it only exists in the latter versions.
pmroz
Super User

Re: How to Set a Check Box to default on?

This version sets all of the checkboxes to checked, regardless of how many are in your list.

New Window( "Input Required", <<Modal,
	V List Box(
		align( "Center" ),
		Text Box( "Set Preferences" ),
		Pref = Check Box( {"Remove Single Value", "Remove Duplicates", "Group by Name"}),
		Spacer Box( size( 200, 20 ) ),
		H List Box(
			Button Box( "OK",
				RV = Pref << get( 1 );
				RD = Pref << get( 2 );
				GR = Pref << get( 3 );
			),
			Button Box( "Cancel", Stop() )
		),
	),
	pref_list = pref << get items;
	for (i = 1, i <= nitems(pref_list), i++,
		pref << set(i, 1);
	),
);

Re: How to Set a Check Box to default on?

Ha! Never mind. Yes, you do need the iteration in this case.

 

Ignore: Do you need the explicit iteration at the end? Just send the message to the list and it will distribute it to each of its items.

(pref << get items) << set( 1 );

 

pmroz
Super User

Re: How to Set a Check Box to default on?

Sorry Mark but that doesn't work.  I should have checked (ar ar ar) the scripting index.  Use set all.

New Window( "Input Required", <<Modal,
	V List Box(
		align( "Center" ),
		Text Box( "Set Preferences" ),
		Pref = Check Box( {"Remove Single Value", "Remove Duplicates", "Group by Name"}),
		Spacer Box( size( 200, 20 ) ),
		H List Box(
			Button Box( "OK",
				RV = Pref << get( 1 );
				RD = Pref << get( 2 );
				GR = Pref << get( 3 );
			),
			Button Box( "Cancel", Stop() )
		),
	),
	pref << set all(1)
);