[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'MaskEdit' (#lcl)

# TCustomMaskEdit.HandleKeyPress

Handle all keys from KeyPress and Utf8KeyPress.

## Declaration

Source position: maskedit.pp line 297

`protected procedure TCustomMaskEdit.HandleKeyPress(`
`var Key: TUTF8Char`
`);`

## Arguments

`Key` |  | Character value for the key examined in the method.

## Description

HandleKeyPress is a method used to handle keys forwarded from the KeyPress and UTF8KeyPress methods. No actions are performed in the method if the control is ReadOnly, or IsMasked returns False.

HandleKeyPress set the cursor position to the start of the current selection in the control. If the cursor is on a mask literal, it is advanced to the next writable position.

When Key is a Period ('.') or a Comma (',') character, the cursor is advanced to the next Period or Comma character in the mask. For other character values, the InsertChar method is called.

The value in Key is set to an empty string ('') when it is handled in the method.