"Timer"
GUIKit`
GUIKit`
"Timer"
GUIKitで提供されていた機能は,組込みのWolfram言語にネイティブのインターフェース構造およびコントロール関数で利用できるようになった.
Widget["Timer"]
時間制限のあるアクションを作成する.
詳細
- Widget["Timer"]を使用する際は,まずNeeds["GUIKit`"]を使って GUIKit をロードする必要がある.
- Widget["Timer"]は,呼出しをバインドすることのできる時間制限のあるアクションを作ることができる便利な非ユーザインターフェースウィジェットである.開始することと停止することができ, その"delay"特性は実行中にミリ秒単位で変更することができる.
- 使用可能な特性:
-
"delay" イベント間の時間(ミリ秒) "initialDelay" 最初のイベントが動作するまでの初期遅延(ミリ秒) - 使用可能なイベント:
-
"action" タイマーがセットされるたびに開始されるイベント - 使用可能なメソッド:
-
"start" 同じタイマーでアクションの動作を開始させるようにリクエストする "stop" 同じタイマーでアクションの動作を停止させるようにリクエストする
例題
すべて開く すべて閉じる例 (1)
Needs["GUIKit`"]ref = GUIRun[
Widget["Frame", {
"title" -> "Timer Example",
{Widget["Button", {"text" -> "Start",
BindEvent["action",
InvokeMethod[{"myTimer", "start"}]]}],
Widget["Button", {"text" -> "Stop",
BindEvent["action",
InvokeMethod[{"myTimer", "stop"}]]}]},
Widget["Slider", {"minimum" -> 50, "maximum" -> 3000,
"value" -> 1000,
BindEvent["change",
Script[ SetPropertyValue[{"myTimer", "delay"},
PropertyValue[{"slider", "value"}] ]]]},
Name -> "slider"],
Widget["Timer", {"delay" -> 1000,
BindEvent["action",
Script[Print["timer triggered!"]]]},
Name -> "myTimer"]
}]
]GUIScreenShot[ref]インタラクティブな例題 (1)
Needs["GUIKit`"]ref = GUIRun[
Widget["Panel", {
Widget["Button", {"text" -> "Print",
BindEvent["mousePressed", InvokeMethod[{"myTimer", "start"}]],
BindEvent["mouseReleased", InvokeMethod[{"myTimer", "stop"}]]
}],
Widget["Timer", {
"delay" -> 20,
"initialDelay" -> 0,
BindEvent["action",
Script[Print["timer triggered!"]]]},
Name -> "myTimer"]
}]
]