移動先: 概要 戻り値 フラグ. MEL 例.

概要

hotkeyCheck [-altModifier] [-commandModifier] [-ctrlModifier] [-keyString string] [-keyUp] [-optionModifier]

hotkeyCheck は 「元に戻す」が可能、「照会」が不可能「編集」が不可能 です。

このコマンドは、指定したホットキーが nameCommand オブジェクトにマップされているかどうかをチェックします。マップされている場合は、nameCommand オブジェクトの注釈が返されます。 マップされていない場合は、空の文字列が返されます。

戻り値

stringnameCommand オブジェクトの注釈または空の文字列。

フラグ

altModifier, commandModifier, ctrlModifier, keyString, keyUp, optionModifier
ロング ネーム(ショート ネーム) 引数型 プロパティ
-keyString(-k) string create
チェックするキーです。
-altModifier(-alt) create
Alt キーを押すかどうかを指定します。
-optionModifier(-opt) create
option キーを押すかどうかを指定します。
-commandModifier(-cmd) create
コマンド キーを押すかどうかを指定します。
-ctrlModifier(-ctl) create
Ctrl キーを押すかどうかを指定します。
-keyUp(-kup) create
ホットキーをキーアップまたはキーダウンにするか(つまり離すか押すか)を指定します。

: コマンドの作成モードで使用可能なフラグ : コマンドの編集モードで使用可能なフラグ
: コマンドの照会モードで使用可能なフラグ : 1 つのコマンドで複数回使用可能なフラグ

MEL 例

//    Create a window in which you can type a hotkey character
//    and determine via the 'hotkeyCheck' command the annotation
//    of the command attached.
//
string $window = `window -title "hotkeyCheck Example"`;
columnLayout -adjustableColumn true;

//    A few instructions in a scrollField for the user.
//
string $instructions = ("Enter a single character in the field "
    + "below.  Then press the \"Query\" button to determine "
    + "the annotation of the command attached to that hotkey.");
scrollField -text $instructions -editable false -height 120
    -wordWrap true;
string $textFieldGrp = `textFieldGrp
    -label "Enter a single hotkey character" -text "a"
    -columnWidth2 200 50`;

//    Create a couple controls for specifying modifier keys and the
//    key press/release information.
//
string $checkBoxGrp = `checkBoxGrp -label "Modifiers"
    -numberOfCheckBoxes 2
    -labelArray2 "Ctrl" "Alt" -columnWidth3 100 75 75`;
string $radioButtonGrp = `radioButtonGrp -label "Action"
    -numberOfRadioButtons 2 -select 1
    -labelArray2 "Press" "Release" -columnWidth3 100 75 75`;

//    Create a scroll field for printing the results.
//
string $scrollField = `scrollField -editable false -height 120
    -wordWrap true`;

//    Create a button for querying the hotkey.
//
button -label "Query" -command ("ExampleHotkeyCheck " + $textFieldGrp
    + " " + $checkBoxGrp + " " + $radioButtonGrp + " " + $scrollField);

showWindow $window;

//    This procedure uses the 'hotkeyCheck' command to determine the
//    annotation of the command attached to a hotkey.
//
global proc ExampleHotkeyCheck(
    string $textFieldGrp,
    string $checkBoxGrp,
    string $radioButtonGrp,
    string $scrollField)
{
    string $result;
    string $mapping;

    //    Get the hotkey character, modifier state and key press/release
    //    information from the window.
    //
    string $key = `textFieldGrp -query -text $textFieldGrp`;
    int $ctrl = `checkBoxGrp -query -value1 $checkBoxGrp`;
    int $alt = `checkBoxGrp -query -value2 $checkBoxGrp`;
    int $press = `radioButtonGrp -query -select $radioButtonGrp`;

    //    Get the hotkey mapping taking into consideration key up or down
    //    and the state of the modifier keys.
    //
    if (1 == $press) {
        if (!$ctrl && !$alt) {
            $mapping = `hotkeyCheck -keyString $key`;
            $result = ($key + "-Press");
        } else if ($ctrl && !$alt) {
            $mapping = `hotkeyCheck -keyString $key -ctl`;
            $result = ("Ctrl-" + $key + "-Press");
        } else if (!$ctrl && $alt) {
            $mapping = `hotkeyCheck -keyString $key -alt`;
            $result = ("Alt-" + $key + "-Press");
        } else if ($ctrl && $alt) {
            $mapping = `hotkeyCheck -keyString $key -ctl -alt`;
            $result = ("Ctrl-Alt-" + $key + "-Press");
        }
    } else {
        if (!$ctrl && !$alt) {
            $mapping = `hotkeyCheck -keyString $key -keyUp`;
            $result = ($key + "-Release");
        } else if ($ctrl && !$alt) {
            $mapping = `hotkeyCheck -keyString $key -ctl -keyUp`;
            $result = ("Ctrl-" + $key + "-Release");
        } else if (!$ctrl && $alt) {
            $mapping = `hotkeyCheck -keyString $key -alt -keyUp`;
            $result = ("Alt-" + $key + "-Release");
        } else if ($ctrl && $alt) {
            $mapping = `hotkeyCheck -keyString $key -ctl -alt -keyUp`;
            $result = ("Ctrl-Alt-" + $key + "-Release");
        }
    }

    //    Print the results in the example window.
    //
    if ("" == $mapping) $mapping = "Nothing";
    scrollField -edit
        -text ($result + " is mapped to:\n\n" + $mapping) $scrollField;
}