問題
スライダー ボックスを使用して連続値を設定し、スライダーを移動するときに現在の値を確認したいとします。
解決
スライダーボックスと数値編集ボックスを作成します。 スライダー ボックスにスクリプトを追加して、数値編集ボックスを更新します。 数値編集ボックスにスクリプトを追加して、スライダー ボックスを更新します。
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></SETFUNCTION>
Window with Slider and Edit boxes launches 2nd windowWindow with Slider and Edit boxes launches 2nd windowスライダーと編集ボックスのあるウィンドウが 2 番目のウィンドウを起動します
議論
スライダー ボックスと数値編集ボックスの動作は異なります。 スライダー ボックスは変数 (Eggs など) を保持し、スライダーが移動するとその変数を更新します。 スライダー コールバック スクリプトは変数を直接使用できます。 Number Edit Box は変数を保持せず、更新しません。 Eggs Number Edit のコールバック関数は、<
NumberEditBox ではなく TextBox を使用して、もう少し単純なバリエーションを作成することもできますが、正確な値を入力することになるでしょう。スライダーではこれが困難です。
関連項目
http://www.jmp.com/support/help/Display_Boxes.shtml
「ヘルプ」->「書籍」->「JSL 構文リファレンス」
スライダー ボックスのスクリプトで丸めることにより、整数出力を与えるスライダー ボックスを取得できます。
Names Default To Here( 1 );
sliderValue = .6;
New Window("Slider", v list box(
text box("Slider box with integer output."),
slider box(
0,
10,
sliderValue,
sliderValue = round(sliderValue);
tb << Set Text( char( sliderValue ) )
),
tb = text box("")
));ありがとう!
追加する必要があります
gb<<INVAL></INVAL>
2 つのコールバック関数 (卵とベーコンの数値編集ボックス用) で、GraphBox に自身を再描画するように通知します。 <<無効とは、無効にするそして再描画をトリガーします。 グラフ ボックスを作成した方法では、再描画時に変更されたデータが取得されます。
こんにちは、クレイグ
素晴らしい投稿をありがとうございます!
私が抱えている問題を説明するために、スクリプトを少し変更しました。
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,
gb << Set Graphics Script( Marker( {Bacon, 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></SETFUNCTION>私の問題は、数値編集ボックスに数値を入力してもグラフが更新されないことです。 「Enter」を押すとスライダーは移動しますが、グラフには変化が反映されません。 いくつか試してみましたが、解決方法がわかりません。
助けていただければ幸いです?
BR
ジェスパー