KeymanWeb 2.0 Events
A number of KeymanWeb events are exposed to allow the designer of a user interface to control the appearance and behavior of user interface elements. Standard event-processing requires all arguments to be passed as an array (object) with named member variables.
Event name | Named arguments | Description |
---|---|---|
kmw.controlfocused | target,activeControl | input element receives focus |
kmw.controlblurred | target,event,isActivating | input element loses focus |
kmw.keyboardregistered | internalName,language,keyboardName,languageCode | keyboard 'stub' processed (for listing as available keyboard) |
kmw.keyboardloaded | internalName | keyboard code loaded |
kmw.beforekeyboardchange | internalName,languageCode | keyboard input language about to change |
kmw.keyboardchange | internalName,languageCode | keyboard input language changed |
kmw.loaduserinterface | (None) | allow ui initialization |
kmw.unloaduserinterface | (None) | allow ui clean-up |
osk.show | x,t,userLocated | OSK displayed |
osk.hide | HiddenByUser | OSK hidden |
osk.resizemove | (None) | OSK resized or moved on desktop |
Object events are handled in user code by passing the handler entry to the object, using addEventListener().
So to define a user function to handle the KeymanWeb core kmw.keyboardchange event, include:
keymanweb.addEventListener('keyboardchange', function(p) { ui.updateMenu(p['internalName'],p['languageCode']); });
or a user function to modify the user interface when the on-screen keyboard is displayed:
osk.addEventListener('show', function(p) { ui.updateUI(p['x'],p['y'],p['userLocated']); });