Squirrel/Client/Functions/Controls/UnbindKey

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(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

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events


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

  1. bool UnbindKey( int key, [ int state, closure func ] )
  1. 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.

  1.  
  2. function onScriptUnload()
  3. {
  4. UnbindKey( 'H', BINDTYPE_DOWN, "HalloThere" );
  5.  
  6. return 1;
  7. }
  8.  

[edit] Notes

The event onScriptUnload was used in in this example. More info about it in the corresponding page.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox