Problem
You want to use a Slider Box to set a continuous value, and you want to see the current value as you move the slider.
Solution
Make a Slider Box and a Number Edit Box. Add a script to the Slider Box to update the Number Edit Box. Add a script to the Number Edit Box to update the Slider Box.
Eggs = 50;
Bacon = 50;
New Window( "Slider Display",
Border Box( Left( 10 ), Right( 10 ), top( 10 ), bottom( 10 ),
V List Box(
H List Box(
Text Box( "Eggs" ), // slider label
eggssb = Slider Box( 0, 100, Eggs, // slider script follows...
eggsnb << set( Eggs ); // update the value
// this example doesn't need any other interactive
// update. You could do some other work here, using
// the slider's value to change a graph, perhaps.
),
// text box to hold the slider's value...
eggsnb = Number Edit Box( Eggs, <<setfunction(
Function( {this}, // if the text box value changes
Eggs = this << get; // get the value
eggssb << inval; // update the slider
)
)
)
),
H List Box(
Text Box( "Bacon" ), // slider label
baconsb = Slider Box( 0, 100, Bacon, // slider script follows...
baconnb << set( Bacon ); // update the value
),
// text box to hold the slider's value...
baconnb = Number Edit Box( Bacon, <<setfunction(
Function( {this}, // if the text box value changes
Bacon = this << get; // get the value
baconsb << inval; // update the slider
)
)
)
),
Button Box( "Make Breakfast", // button script follows...
New Window( "Breakfast", Text Box( "eggs: " || Char( eggs ) || " and bacon: " || Char( bacon ) ) )
)
)
)
);
Window with Slider and Edit boxes launches 2nd window
Discussion
Slider Box and Number Edit Box have different behaviors. The Slider Box holds on to the variable (Eggs, for example) and updates that variable when the slider moves. The slider callback script can use the variable directly. The Number Edit Box does not hold on to the variable, and does not update it. The callback function for the Eggs Number Edit uses <<get to get the current value and store it into Eggs. But then it only needs to prod the slider with an <<inval to tell the slider to repaint the display. The slider will get the value to repaint from the Eggs variable.
You could make a slightly simpler variation using TextBox rather than NumberEditBox, but you'll probably want to enter an exact value, which is hard with a slider.
See Also
http://www.jmp.com/support/help/Display_Boxes.shtml
Help->Books->JSL Syntax Reference