cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
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

Recommended Articles