WoW:API GetBindingKey: Difference between revisions

From AddOn Studio
Jump to navigation Jump to search
No edit summary
(upgraded deprecated template)
Line 1: Line 1:
{{wowapi}}
<center>'''GetBindingKey'''</center>
<center>'''GetBindingKey'''</center>


Line 23: Line 24:
  if (key1) then DEFAULT_CHAT_FRAME:AddMessage(key1,1.0,1.0,1.0); end
  if (key1) then DEFAULT_CHAT_FRAME:AddMessage(key1,1.0,1.0,1.0); end
  if (key2) then DEFAULT_CHAT_FRAME:AddMessage(key2,1.0,1.0,1.0); end
  if (key2) then DEFAULT_CHAT_FRAME:AddMessage(key2,1.0,1.0,1.0); end
----
{{Template:WoW API}}

Revision as of 18:11, 6 January 2007

WoW API < GetBindingKey

GetBindingKey

Returns all keys currently bound to the command specified by command. This function is almost identical to GetBinding(index) except it takes the command name as an argument instead of the index and doesn't return the command name along with the key bindings.


Arguments
(String command)
command
The name of the command to get key bindings for (e.g. MOVEFORWARD, TOGGLEFRIENDSTAB)

Returns
key1, key2, ..., keyN
key1-N
(string) The string representation of the key bound to this command (e.g. W, UP). Even though the default key binding GUI window only displays 2 possible keys bound to each command, it appears there is no limit to the number of keys that can be bound to a single command. This function will return as many keys as have been set with SetBinding("key"{,"command"}). If no keys are bound to the action, it will return nil.

Example
key1, key2 = GetBindingKey("MOVEFORWARD");
DEFAULT_CHAT_FRAME:AddMessage("Move Forward has the following keys bound:",1.0,1.0,1.0);
if (key1) then DEFAULT_CHAT_FRAME:AddMessage(key1,1.0,1.0,1.0); end
if (key2) then DEFAULT_CHAT_FRAME:AddMessage(key2,1.0,1.0,1.0); end