Keypress Notify Event - Tab Control
Template
context:u(2),code:i(1),id:u(2),objtype:i(2),keycode:u(2),syskey:u(1)
This Notify event is generated when a key is pressed while the tab control has focus--as indicated by the text on a tab label being highlighted. The key that was pressed can be determined from the value of the keycode parameter, and the state of system keys (Shift, Ctrl, etc.) can be determined from the value of the syskey parameter. The principle is similar to the Key pressed event returned by windows (event code="t"), but some of the values are different and the format in which the pressed key is reported is different.
Field |
Description |
context |
Context on which event occurred. |
code |
Always 1. |
id |
ID of the tab control. |
objtype |
Always 106. |
keycode |
Hexadecimal representation of the key that was pressed. If a letter key is pressed, the code returned corresponds to the ASCII representation of the letter in upper case, regardless of the state of the shift key. Note that the next field indicates the status of the shift key, Ctrl key, etc. The following codes are returned for special keys and other keys that do not return ASCII codes: |
syskey |
Indicates the state of the system keys: |
Example
The following statements trap the F1 key when the focus is on a tab and display a message box. These statements would appear in an event loop, and assume that the generic$ variable has been templated:
if event.code$="N" then
generic$=notice(sysgui,event.x);
dim notice$:noticetpl(generic.objtype,event.flags);
notice$=generic$
if event.code$="N" and notice.code=1 and event.id=tab_control_id then
if notice.keycode$=$014B$ and notice.syskey$=$00$ then
result=msgbox("Help not available.")
See Also
NOTICE() Function - Get SYSGUI Notice String