|hMsg||The message handle of a published procedure that will be called when the key event occurs|
|bShift||Determines whether Shift key needs to be pressed to trigger event|
|bAlt||Determines whether Alt key needs to be pressed to trigger event|
|bCtrl||Determines whether Crtrl key needs to be pressed to trigger event|
Procedure AddKeyHandler Handle hMsg Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl
|Call:||Send AddKeyHandler hMsg iKeyCode bShift bAlt bCtrl|
It is possible to assign custom key handlers to controls and containers. This is done by using the AddKeyHandler and RemoveKeyHandler procedures. These procedures are client actions and the administration of key handlers is kept on the client. This means that these procedures should be used after the control is available on the client or when it is loaded to the client. Common practice will be to call these procedures during the OnLoad event.
The system relies on the HTML DOM Event bubbling system, so key events inside controls can be handled on their wrapping containers. So, a key handler on the view will catch key events on a form inside that view. If a key event is handled by a control or container, it will stop bubbling and other handlers will not be triggered. This is also true for key handlers implemented in the client-side control. The default browser behavior will be cancelled, if possible.
Procedure InfoKey Integer iKeyCode Boolean bShift Boolean bAlt Boolean bCtrl Send ShowInfoBox "This is an information dialog!" End_Procedure WebPublishProcedure InfoKey Procedure OnLoad Send AddKeyHandler (RefProc(InfoKey)) 112 False False False End_Procedure
The example above shows how to attach a procedure to the F1 key immediately when the application is loaded.