Events - Keyman Engine for Web
A number of 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.
Two components of Keyman Engine for Web specify events:
keyman
object -- the main componentkeyman.osk
object -- the on-screen keyboard component
Object events are handled in user code by passing the handler entry to the object, using addEventListener().
keyman
events
beforekeyboardchange
: Called when keyboard input language about to change.
controlblurred
: Called when input element loses focus.
controlfocused
: Called when input element receives focus.
keyboardchange
: Called when keyboard input language changed.
keyboardloaded
: Called when keyboard code loaded.
keyboardregistered
: Called when keyboard 'stub' processed (for listing as available
keyboard).
loaduserinterface
: Called when allow ui initialization.
unloaduserinterface
: Called when allow ui clean-up.
For example, to define a user function to handle the KeymanWeb
keyboardchange
event, include:
keyman.addEventListener('keyboardchange',
function(p)
{
ui.updateMenu(p.internalName,p.languageCode);
});
keyman.osk
On Screen Keyboard events
configclick
: Called when allows the UI to present KeymanWeb configuration
options.
helpclick
: Called when allows the UI to present a help page.
hide
: Called when OSK hidden.
resizemove
: Called when OSK resized or moved on desktop.
show
: Called when OSK displayed.
For example, to add an event handler that modifies the user interface when the on-screen keyboard is displayed:
keyman.osk.addEventListener('show',
function(p)
{
ui.updateUI(p.x, p.y, p.userLocated);
});