WoW:API IsShiftKeyDown: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
("IsControlKeyDown", not "IsCtrl")
(Added note that Shift/Control/Alt key events only return 1 if it is a modifier, not part of a keybind)
Line 18: Line 18:


   if ( IsShiftKeyDown() ) then DoSomething(); end
   if ( IsShiftKeyDown() ) then DoSomething(); end
== Note ==
These functions will only return true if one of the keys is considered a modifier.  If the code executing is started with Shift/Control/Alt as part of the key binding, it will return nil.
[[User:Govtgeek|Govtgeek]] ([[User talk:Govtgeek|talk]]) 01:30, 8 March 2009 (UTC)

Revision as of 01:30, 8 March 2009

WoW API < IsShiftKeyDown

Returns true if the shift/ctrl/alt key is currently depressed.

shiftDown = IsShiftKeyDown();
ctrlDown  = IsControlKeyDown();
altDown   = IsAltKeyDown();

Arguments

none

Returns

Boolean
1 (true) if the given key is currently held down, nil otherwise.

Related Events

MODIFIER_STATE_CHANGED - fires when shift/ctrl/alt keys are pressed or released

Example

 if ( IsShiftKeyDown() ) then DoSomething(); end

Note

These functions will only return true if one of the keys is considered a modifier. If the code executing is started with Shift/Control/Alt as part of the key binding, it will return nil. Govtgeek (talk) 01:30, 8 March 2009 (UTC)