Commands / compatibilityMode()

Description

Compatibility Mode attempts to reconcile the differences between the following pairs of keyCodes across different operating systems:

(13) RETURN  & (10)  ENTER
(18) Command & (17)  CONTROL
(8)  DELETE  & (127) BACKSPACE

Compatibility Mode is set to true by default. This causes a Command object to treat the above pairs of keyCodes as if they were produced by identical keystrokes. For example, if we create the the following command in Compatibility Mode … like so …


import compose.commands.*;
Commands commands;
void setup() {
   commands = new Commands(this);
   commands.add("doSomething", CONTROL, 'c');
}

… doSomething() will fire if we press either ⌘+C (on the Mac) or CTRL+C.

Calling compatibilityMode(false) on a Command object will cause it to treat these key codes distinctly. Meaning ⌘+C would not make doSomething() fire in the example above. Calling compatibilityMode(true) restores the Command object to its default behavior.

Syntax
commands.compatibilityMode(isOn)
Parameters
isOn
bool: true or false
Returns
None
Usage
Web & Applications
Related
Last Modified: April 13, 2010

No Comments

You must be logged in to post a comment.