Your Ad Here

Go to: Synopsis. Return value. MEL examples.

Synopsis

getModifiers

getModifiers is undoable, queryable, and editable.

This command returns the current state of the modifier keys. The state of each modifier can be obtained by testing for the modifier's corresponding bit value in the return value. Shift is bit 1, Caps Lock is bit 2, Ctrl is bit 3, and Alt is bit 4. See the provided example for more details on testing for each modifier's bit value.

Return value


int indicating which modifier keys are pressed.

MEL examples

window;
columnLayout;
button -label "Press Me" -command "PrintModifiers";
showWindow;

global proc PrintModifiers()
{
    int $mods = `getModifiers`;
    print ("Modifiers are:");
    if ($mods & 1) print (" Shift");
    if ($mods & 2) print (" CapsLock");
    if ($mods & 4) print (" Ctrl");
    if ($mods & 8) print (" Alt");
    print ("\n");
}

  

Return to Autodesk Index


Your Ad Here