WtLookupString Function
Maps a KeyPress or KeyRelease event to its KeyEvent structure (and optionally, to its Keysym) when a user presses a key.
Usage
string = WtLookupString(event)
Input Parameters
event — A KeyEvent structure associated with the KeyPress event. The KeyEvent structure is passed to the callback procedure.
Returned Value
string — A string containing the name of the key which was pressed. A null string is returned for the <Shift>, <Ctrl>, <Alt>, and function keys.
Keywords
Keysym — Returns a value associated with the key pressed.
 
note
For Motif, Keysym returns a long value (XKeysym) associated with the key pressed. Keysym is an integer value unique to a particular key on the keyboard. This value can be used to identify function key presses.
For Windows, Keysym returns the long value of the virtual key associated with the key pressed (the result of the VkKeyScan procedure). For a list of virtual key codes and keys they map to, see Virtual Keys in the PV‑WAVE Application Developer’s Guide or the Win32 Programmer’s Reference.
Discussion
WtLookupString is used in the callback of a KeyPress or KeyRelease event to map the event into the string it represents. The call is used specifically to handle null strings, which are returned whenever an unprintable character (such as <Shift>, or a function key) is pressed.
Keysym is used in situations where the pressed key must be identified. The include file <X11/keysymdef.h> contains a complete Keysym listing.
 
note
Rogue Wave has ported a subset of the Widget Toolbox (Wt) functionality available for Motif to Microsoft Windows. Because the Widget Toolbox under Windows is not a complete implementation, we recommend that Windows developers use PV‑WAVE Widgets (Ww) layer or the VDA Tools when developing GUI applications.
Examples
The following example illustrates the use of WtLookupString to obtain the string name associated with a KeyPress event.
string = WtLookupString(event)
The following usage of WtLookupString returns the string associated with the event as well as the Keysym associated with the key pressed.
string = WtLookupString(event, keysym=ks)
See Also
For detailed information on GUI development, refer to the PV‑WAVE Application Developer’s Guide.
For more information about how to write an application program based on PV‑WAVE Widgets, refer to Using Wave Widgets in the PV‑WAVE Application Developer’s Guide.
For detailed information on Keysyms, see Appendix H, “Keysyms,” of the Xlib Reference Manual (Vol. 2) for Version 11 (O’Reilly & Associates, 1988).