cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Range Slider Box with Connected Number Edit Boxes
MathStatChem
Level VI

Just figured out a nice solution to control a range slider box with both the slider controls and number entries and I wanted to share.  This is similar to Combined and Connected Number Edit Box and Slider Box - JMP User Community.  

Here is an example:

 

 

Names Default To Here( 1 );
minrange = 0;
ll = 60;
ul = 90;
maxrange = 100;
New Window( "Range Slider Box with Number Edit Boxes",
	Panel Box( "Slider Box with Number Entry Controls",
		H List Box(
			Text Box( "This Controls the Lower Limit->" ),
			neb_ll = Number Edit Box( ll ),
			rsb = Range Slider Box( minrange, maxrange, ll, ul ),
			neb_ul = Number Edit Box( ul ),
			Text Box( "<-This Controls the Upper Limit" )
		)
	)
);
// now that the display is created, add the script and function controls

// range slider box script
rsb << Set Script(
	neb_ll << set( ll );
	neb_ul << set( ul );
	// possibly do other stuff in other parts of the report because the limits have been changed
);

// now set the control for the Number Edit Boxes.  This is a bit less obvious
// because Number Edit Boxes on allow attaching a function, not a script

neb_ll << Set Function(
	Function( {thisBox},
		{ll}, 
				// check to make sure that the entered number is 
		// less than the upper limit set for the range slider box and also
		// greater than the the lower end of the range for the range slider box
		// if either condition is not met, then set the value at the 
		// appropriate limit
		ll = Max( minrange, Min( thisBox << get, neb_ul << get ) );
				// apply the value to the lower value for the range slider box
		rsb << Set Lower( ll, 1, Run Script( 1 ) );
		//BTW what does       ^    this argument do?  Not documented? 
		// see https://www.jmp.com/support/help/en/18.0/index.shtml#page/jmp/slider-box-and-range-slider-box-messages.shtml
		// But must be provided.  
	)
);

neb_ul << Set Function(
	Function( {thisBox},
		{uu}, 
		// same idea, keep the value in between the lower value for the range
		// slider box and the lower end of the range slider box range
		uu = Min( maxrange, Max( thisBox << get, neb_ll << get ) );
		rsb << Set Upper( uu, 1, Run Script( 1 ) );
	)
);

Recommended Articles