[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

National Language Support Guide and Reference

Using Callbacks

Applications that use input methods should provide callback functions so that the Input Method Editor (IMED) can communicate with the user. The type of input method you use determines whether or not callbacks are necessary. For example, the single-byte input method does not need callbacks, but the Japanese input method uses them extensively with the pre-edit facility. Pre-editing allows processing of characters before they are committed to the application.

When you use an input method, only the application can insert or delete pre-edit data and scroll the text. Consequently, the echo of the keystrokes is achieved by the application at the request of the input method logic through callbacks.

When you enter a keystroke, the application calls the IMFilter subroutine. Before returning, the input method can call the echoing callback function for inserting new keystrokes. After a character has been composed, the IMFilter subroutine returns it, and the keystrokes are deleted.

In several cases, the input method logic has to call back the client. Each of these is defined by a callback action. The client specifies which callback should be called for each action.

Types of callbacks are described as follows:

Initializing Callbacks

All callbacks must be identified when you call the IMCreate subroutine. The IMCallback structure contains the address for each callback function. The caller of the IMCreate subroutine must initialize the IMCallback structure with the addresses.

The callback functions can be called before the IMCreate subroutine returns control to the caller. Usually, the IMTextStart callback is called to identify the size of the pre-edit buffer.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]