プログレスバープログレスバーを作成する方法を示しました。 @abmayfieldでの質問「反応しない」vs.「まだ考えている」これを再検討するように促しました。 こちらはキャンセルボタンを含む別の例です。
not cancelednot cancelednot cancelednot canceledキャンセルされていない
Cancel button pressed.Cancel button pressed.Cancel button pressed.Cancel button pressed.キャンセルボタンが押されました。
progressBarWidth = 500;
progressUpdatesSeconds = 1 / 4; // 1/2 sec updates -> 1300ips, 1/30 -> 1000ips (1/4 compromise speed vs appearance)
cancel = 0; // clear the cancel flag
New Window( "Progressbar demo", //
V List Box( //
cats = Text Box( "" ), // output from the work function
t = Text Box( "", <<SETWRAP> ^workCalls/runSeconds^ ips" ) );
t << updatewindow; // this works without the wait
);
totalCats = 0;
dowork = Function( {},
x = "";
For( i = 1, i <= 1000, i += 1, x = x || "." );
totalCats += 1000;
cats << settext( Eval Insert( "total concatenations=^totalCats^" ) );
);
While( runSeconds < limitSeconds & !cancel, // change this to represent the work you are doing
// do some work, simulated by concatenating strings...
dowork();
// update the progressbar
workCalls += 1;
nowMicroSeconds = HP Time();
// how often does it need to update on the screen?
If( (nowMicroSeconds - recentUpdateMicroSeconds) / 1e6 > progressUpdatesSeconds,
// in this example I'm using a fixed time duration of "limitSeconds" to represent the
// amount of work to be done. And "runSeconds" to represent the amount of work done so far.
// Usually you'll have something other than time: number of rows in a table perhaps, or
// number of categories to make reports for. As long as you know how many total and how
// many completed, you can compute this fraction...
updateProgress( runSeconds / limitSeconds ); // change this to represent the fraction of work finished
recentUpdateMicroSeconds = nowMicroSeconds;
Wait( 0 ); // this wait is needed to let the cancel button work
);
runSeconds = (nowMicroSeconds - startMicroSeconds) / 1e6;
);
If( cancel, // test the cancel flag
Beep(); // audio flag
left << color( "dark red" ); // visual flag something is awry
right << color( "red" );
, //
updateProgress( 1.0 ); // people like to see the bar go to 100%
);
cancelButton << setbuttonname( "Close" ); // visual flag the button function is changed
cancelButton << setscript( (cancelButton << closewindow) ); // and what to do if the button is pressed
</SETWRAP>
JMP 15 と 16 の間でテストしたところ、16 は多くこの文字列連結の作業負荷がより高速になります。 よくやった!
編集: JMP が独自のキャンセル可能な進行状況バーを持たないプラットフォームを実行していて、長時間実行される場合、これは役に立ちません。 プログレス バーのプラットフォーム サポートをリクエストするには、テクニカル サポートが適しています。 これがないと、完了するまで JMP を停止する方法 (強制的に終了する以外) がありません。
梱包希望です、よろしくお願いします!
あなたの例では、 pb<
私が見落としていた点も指摘していただきましたクラス定義の使い方: クラスプロトタイプの定義で明示的にクラスメンバーを配置する必要があると思ったのですが、これ:それらを作成することもできます。
Define Class("bubble",
//not needed: m_xpos = .;
_init_ = Method( {x}, <BR />//because using explicit this: ...
this:m_xpos = x;
ありがとう@Craige_Hales ! たまたま自分のスクリプトの 1 つに進行状況バー (またはそれに類似したもの) が必要だったので、これを使用して、ニーズに合わせて少し修正しました。 私はそれをクラスに変えました(JMPのクラスとクラス全般については非常に初心者です)。練習するそれは一つに収まる気がしたからです。 また、Natural Docs で解析できるドキュメントをいくつか追加しました。
コード:
もっと見る...Natural ドキュメントは次のようになります。
