cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar
aallman
Level III

Select All Checkbox

I made a script that contains a list of check boxes followed by a "Select All" Check box.  I set the function of the "Select All" check box to select all of the other boxes when it is checked, but now I cannot figure out how to uncheck all the other boxes when the "Select All" check box is unchecked.

 

Any suggestions?

V List Box(

othicb = Check Box( {"MOErA*", "MOErC*", "MOErT*", "MOErG*"} ),

Spacer Box( 25 ),

H List Box(othia = Check Box( " ", <<SetFunction( othicb << Set All( 1, run script( 1 ) ) ) ), Text Box("Select All Thioated MOE", <<Set Width(90), <<Set Wrap(90)))

),

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Select All Checkbox

Instead of always setting all values to 1, you will want to set the values to the value of the Select All Check Box. You can do this using the Get message. See example below for details.

New Window( "test",
	V List Box(
		othicb = Check Box( {"MOErA*", "MOErC*", "MOErT*", "MOErG*"} ),
		Spacer Box( 25 ),
		H List Box(
			othia = Check Box(
				" ",
				<<SetFunction( 
					function({this},
						othicb << Set All( this << Get, run script( 1 ) )
					)
				)
			),
			Text Box(
				"Select All Thioated MOE",
				<<Set Width( 90 ),
				<<Set Wrap( 90 )
			)
		)
	)
);
Justin

View solution in original post

2 REPLIES 2
txnelson
Super User

Re: Select All Checkbox

You have the answer in your own code.  Take a look at the code below, and also take a look into the Scripting Index for the Check Box()

     Help==>Scripting Index==>>CheckBox

Names Default To Here( 1 );
New Window( "test",
	V List Box(
		othicb = Check Box( {"MOErA*", "MOErC*", "MOErT*", "MOErG*"} ),
		Spacer Box( 25 ),
		H List Box(
			othia = Check Box(
				" ",
				<<SetFunction(
					If( othia << get( 1 ) == 1,
						othicb << Set All( 1, run script( 1 ) ),
						othicb << Set All( 0, run script( 1 ) )
					)
				)
			),
			Text Box( "Select All Thioated MOE", <<Set Width( 90 ), <<Set Wrap( 90 ) )
		)
	)
);
Jim

Re: Select All Checkbox

Instead of always setting all values to 1, you will want to set the values to the value of the Select All Check Box. You can do this using the Get message. See example below for details.

New Window( "test",
	V List Box(
		othicb = Check Box( {"MOErA*", "MOErC*", "MOErT*", "MOErG*"} ),
		Spacer Box( 25 ),
		H List Box(
			othia = Check Box(
				" ",
				<<SetFunction( 
					function({this},
						othicb << Set All( this << Get, run script( 1 ) )
					)
				)
			),
			Text Box(
				"Select All Thioated MOE",
				<<Set Width( 90 ),
				<<Set Wrap( 90 )
			)
		)
	)
);
Justin