Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Other versions
Version 8.0

Index

On this page

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 nameNamed argumentsDescription
kmw.controlfocusedtarget,activeControlinput element receives focus
kmw.controlblurredtarget,event,isActivatinginput element loses focus
kmw.keyboardregisteredinternalName,language,keyboardName,languageCodekeyboard 'stub' processed (for listing as available keyboard)
kmw.keyboardloadedinternalNamekeyboard code loaded
kmw.beforekeyboardchangeinternalName,languageCodekeyboard input language about to change
kmw.keyboardchangeinternalName,languageCodekeyboard input language changed
kmw.loaduserinterface(None)allow ui initialization
kmw.unloaduserinterface(None)allow ui clean-up
osk.showx,t,userLocatedOSK displayed
osk.hideHiddenByUserOSK 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']);
  });