ユーザ インタフェース コントロール > 共通プロパティ > レイアウト > タイプ > Checkbutton |
checkbutton コントロールは、チェック ボックスと同じように、オンおよびオフの 2 つの状態を持つ押しボタンをロールアウトに配置するために使用します。クリックして、オンとオフを連続して切り替えることができます。
構文は次のようになります。
checkbutton <name> [<caption>] [ highlightColor:<color> ] \ [ toolTip:<string> ] [ checked:<boolean> ] [ images:<image_spec_array> ] \ [ border:<boolean> ]
checkbutton 項目の位置合わせの既定値は、 #center です。
例: |
rollout test "Test" ( checkbutton setup "Setup" checked:true tooltip:"Opens setup panels" on setup changed state do if state == on then openRollout setup_pan else closeRollout setup_pan ) |
パラメータ
checked:
チェック ボタンの初期状態です。既定値は off です。
highlightColor:
チェック ボタンを押した(またはオンにした)状態のバックグラウンド色です。 既定値はライトグレーで、3ds Max ユーザ インタフェース規則に従います。
toolTip:
チェック ボタンのツールチップ用のテキストです。指定しない場合、ツールチップは表示されません。
images:
チェック ボタンにビットマップ イメージを提供するためのイメージ仕様配列です。指定すると、 <label> は無視されて、ボタンの内容がビットマップに置き換えられます。
形式は次のとおりです。
images:#(<image>, <maskImage>, <count_integer>, <enabled_out_image_index>, <enabled_in_image_index>, <disabled_out_image_index>, <disabled_in_image_index>)
ここでは、 <image> および <maskImage> は、ビットマップ ファイル名の文字列でも、MAXScript ビットマップ値でもかまいません。 <count_integer> には、ビットマップ内のサブイメージの数を指定し、 image_index 値には、ボタンの 4 つの状態にビットマップのどのサブイメージを使用するかを指定します。
例: |
bm1 = render camera:$cam01 outputSize:[80,60] ... checkbutton foo images:#(bm1, undefined, 1, 1, 1, 1, 1) |
これは、チェック ボタンのイメージとしてレンダリングを使用します。 |
checkbutton decay images:#("dcybtns.bmp","dcymask.bmp", 6, 1, 4, 1, 4) |
これは、ビットマップのサブ イメージ 1 と 4 を使用します。 dcybtns.bmp および dcymask.bmp は、それぞれチェック ボタンのオフまたはオン状態に対応しています。 イメージ ボタン も参照してください。 |
border:
true に設定した場合、または指定しなかった場合、checkbutton は境界線付きで描画されます。これは、3ds Max 2009 より前のバージョンでは既定値の動作でした。
false に設定すると、チェックボタンは境界線なしで描画され、UI の背景が付いたものになります。チェックボタンが有効になっている場合は、チェックボタンが押されたとき、チェックマークが付いているとき、および .checked プロパティが true に設定されていて、マウスが上に置かれているときに、境界線が表示されます。
3ds Max 2009 以降 で使用可能です。
プロパティ:
<checkbutton>.checkedBoolean
チェック ボタンの状態です。オン( true )またはオフ( false )です。
<checkbutton>.state Boolean
.checked と同義です。
<checkbutton>.images Array
チェック ボタンのイメージ設定の配列を設定します。このプロパティは書き込み専用です。
3ds Max 8 以降では、値を undefined に設定すると、コントロールは、イメージではなくキャプションを表示する状態に戻ります。
<checkbutton>.width Integer
3ds Max 2019 の
新機能: チェックボタンの幅をピクセル単位で取得または設定します。
<checkbutton>.height Integer
3ds Max 2019 の
新機能: チェックボタンの高さをピクセル単位で取得または設定します。
例: |
-- re-render, update button bm1 = render() foo.images = #(bm1, undefined, 1, 1, 1, 1, 1) |
<checkbutton>.tooltipString
チェックボタンのツールチップ文字列を取得/設定します。
3ds Max 9 以降 で使用可能です。
例: |
--Evaluate this script, then roll over the checkbutton to read the tooltip. --Check the checkbutton, roll over again to see the new tooltip. --Uncheck the checkbutton and roll over once again to see the new tooltip. ( rollout test "Test" ( checkbutton chk_test "Check Me!" tooltip:"This is a tooltip" on chk_test changed state do chk_test.tooltip = if state then "I am checked!" else "I am unchecked!" ) createDialog test ) |
イベント
on <checkbutton> changed <arg> do <expr>
状態を変えるためにチェック ボタンをクリックすると呼び出されます。 <arg> 引数には、新しいチェック ボタンの状態であるオン( true )またはオフ( false )が含まれます。
例: |
utility testCheckButton "Test The CheckButton" ( checkbutton myCheckButton "Check Me!" -- theState is a user variable name that will contain the state -- of the checkbox whenever the change handler is executed on myCheckButton changed theState do ( if theState == true then myCheckButton.text = "Uncheck Me!" else myCheckButton.text = "Check Me!" ) )--end utility |
on <checkbutton> rightclick do <expr>
ボタン上で右マウス ボタンが放されたときに、呼び出されます。3ds Max 8 以降 で使用可能です。