ObjectDCL Banner

OnKeyDown Event

Description

Indicates that a key has been pressed.

Parameters

sChar
String describing the character that was released.
nRepeatCount
Integer describing the number of types the character was repeated while pressed.
nFlags
Integer describing the keyboard shortcut modifiers: control, alt and shift. See Microsoft documentation for details.

AutoLISP Syntax

Each control that throws this event has its handler that takes this generic form:

CopyCode imageCopy Code
(defun c:FormName_ControlName_OnKeyDown 
                 (sChar [as String] 
                  nRepeatCount [as Integer] 
                  nFlags [as Integer] /)
     
)

Applies For

BlockList, ListView, PictureBox, SlideView, TextBox.

Example

CopyCode imageCopy Code
; React to the key being pressed
(princ c:MyForm_MyControl_OnKeyDown
                 (sChar nRepeatCount nFlags /)
     (princ "OnKeyDown(")
     (princ sChar)
     (princ ",")
     (princ nRepeatCount)
     (princ ", ")
     (princ nFlags)
     (princ ")\n")
)

See Also

OnKeyUp