Squirrel/Client/Functions/Controls/UnbindKey
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: {{Squirrel/Title|UnbindKey}} This function unbinds a key from a previously bound handler function. If only the key (or key and keystate) are defined, all bound functions are removed from ...) |
Latest revision as of 15:45, 11 April 2010
This function unbinds a key from a previously bound handler function. If only the key (or key and keystate) are defined, all bound functions are removed from that key.
[edit] Syntax
bool UnbindKey( int key, [ int state, closure func ] )
bool BindKey( int key, [ int state, string func ] )
[edit] Arguments
- key - This is the key to remove the keybind for. For keys 'A'-'Z' and '0'-'9' this value will be the ascii code of the character. For special keys, check a list here
- state - The bind type, either BINDTYPE_DOWN (triggered when the key is pressed down) or BINDTYPE_UP (triggered when the key is released). This argument is optional
- func - Either a pointer to the handler function or the name of the function as a string. This argument is optional
[edit] Example
This example will remove the bind created in the example for BindKey.
function onScriptUnload() { UnbindKey( 'H', BINDTYPE_DOWN, "HalloThere" ); return 1; }
[edit] Notes
The event onScriptUnload was used in in this example. More info about it in the corresponding page.