Key Listener (ref)
Last updated
Was this helpful?
Last updated
Was this helpful?
(part of package '')
You can access it in code via: plugins.keyListener
A Servoy Extra Component that handles keyboard events and provides key listener functionality.
Registers the listener on the components which have the "keylistener" attribute with the given callbackKey value, to call the given callback when a key is pressed.
Example:
Parameters:
{} callbackKey The key for which the listener will be added. This key has to match value of "keylistener" attribute in component.
{} callback The callback function to be called when a key is pressed.
{} [clearCB] If true a removeKeyListener will be called for this key before adding the new one. Default value is false.
{} [delay] Number of milliseconds to wait before callback method is called. Default value is 1000.
{} [regexPattern] Javascript regular expression string to modify current value of the component.
{} [regexReplacement] The value that is used to replace the regular expression with in the current value of the component.
Removes the listener associated to the given callback key. Returns true if the listener was removed.
Example:
Parameters:
Represents a key listener callback configuration. scripting type: CustomType<keyListener.callback>
callback
The callback function that will be executed when the key event occurs.
callbackKey
The key identifier for the callback. This should match the "keylistener" attribute value in the component.
delay
The delay in milliseconds before the callback is executed after the key event.
isRunning
Indicates whether the callback is currently running.
regexPattern
A JavaScript regular expression string used to modify the current value of the component.
regexReplacement
The string used to replace the parts of the component's value that match the regexPattern.
{} callbackKey The key listener to remove.
Returns: Succes of removal
Type:
Type:
Type:
Type:
Type:
Type: