Project

General

Profile

About


A free plugin to attach key listeners function on any key event in your Servoy fields (keyPressed, keyTyped and keyReleased).

Currently not web compatible, as it makes use of Swing Component listeners.
Not sure if I will make try to make a Wicket (web client) behavior for this one, since it would make Ajax call to the server for each key typed in the "listened" field, which could take your server down after a while...
Will see if I can use some Throttle behavior to implement this safely.
For now in the web client it will not break though, it will just do nothing and tell you so in the server log.

This plugin has been tested on Servoy 3.5.x, 4.1.x and 5.x Developer and Smart client on Windows and Mac OS X and should work on Linux as well since it is just regular Java.
The target compiler settings is Java 1.4.

OK, but what the hell are listeners?

Listeners are any javascript functions that will be triggered by events in the fields, in this particular case keyboard events.
These events are not published by the regular Servoy event system, but available in Java, so this plugin was born to give you access to them in your javascript function.

What can I do with this plugin?

Some examples include:
- to attach a function that will check if the caps lock is down on a password field
- to attach a "default" function to respond to any entered key into a field
- to attach a function that will alter the user's typing, like automatically convert to uppercase for example.

Note that listeners are very powerful, but you will need to release them propertly to avoid any memory leaks, see the sample solution to understand how it needs to be done.