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:

$0008$ Backspace
$0009$ Tab
$000C$ Keypad 5 (numeric keypad with Num Lock off)
$000D$ Enter
$0013$ Break
$0014$ Caps Lock
$001B$ Escape
$006E$ Keypad . decimal (numeric keypad with Num Lock on)
$007F$ Delete
$0090$ Num Lock
$0091$ Scroll Lock
$00BA$ ;
$00BB$ =
$00BC$ ,
$00BD$ - (dash)
$00BE$ . (period)
$00BF$ /
$00C0$ `
$00DB$ [
$00DC$ \
$00DD$ ]
$012D$ Up arrow
$012E$ Down arrow
$012F$ Right arrow
$0130$ Left arrow
$0131$ Page up
$0132$ Page down
$0133$ Home
$0134$ End
$0138$ Insert
$013B$ Backtab
$013E$ Keypad 0 (numeric keypad with Num Lock on)
$013F$ Keypad 1
$0140$ Keypad 2
$0141$ Keypad 3
$0142$ Keypad 4
$0143$ Keypad 5
$0144$ Keypad 6
$0145$ Keypad 7
$0146$ Keypad 8
$0147$ Keypad 9
$014B$ F1
$014C$ F2
$014D$ F3
$014E$ F4
$014F$ F5
$0150$ F6
$0151$ F7
$0152$ F8
$0153$ F9
$0154$ F10
$0155$ F11
$0156$ F12
$0174$ Keypad * (* on numeric keypad)
$0175$ Keypad - (-on numeric keypad)
$0176$ Keypad + (+ on numeric keypad)
$0177$ Keypad / (/ on numeric keypad)

syskey

Indicates the state of the system keys:

$00$ No system key pressed.
$01$ Shift
$02$ Ctrl
$03$ Shift+Ctrl
$04$ Alt
$05$ Alt+Shift
$06$ Ctrl+Alt
$07$ Ctrl+Alt+Shift

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

NOTICETPL() Function - Get Notice String Template

Tab Control Notify Events

BBjTabKeypressEvent