Saltar para o conteúdo principal
Versão: v19

On Before Keystroke

CodePode ser chamado porDefinição
174D Write Pro area - Combo Box - Form - Input - List Box - List Box ColumnUm carácter está prestes a ser introduzido no objecto que tem o foco. Obter texto editado devolve o texto do objecto sem este carácter.
Histórico
VersãoMudanças
v18 R5- Support in non-enterable list boxes- The event is now triggered after IME validation

Descrição

After the On Before Keystroke and On After Keystroke event events are selected for an object, you can detect and handle the keystrokes within the object, using the Form event code command that will return On Before Keystroke and then On After Keystroke event (for more information, please refer to the description of the Get edited text command). Within the On Before Keystroke event, the FILTER KEYSTROKE command can be used to filter typed chars.

Esses eventos também são ativados por comandos de linguagem que simulam uma ação do usuário, como POST KEY.

O evento On Before Keystroke não é gerado:

  • in a list box column method except when a cell is being edited (however it is generated in any cases in the list box method),
  • quando as modificações do usuário não forem realizadas usando o teclado (colar, arrastar e soltar, caixa de seleção, lista suspensa, caixa de seleção). Para processar esses eventos, você deve usar On After Edit.

Objectos não enterráveis

The On Before Keystroke event can be generated in non-enterable objects, e.g. in a list box even if the list box cells are not enterable, or rows are not selectable. This allows you to build interfaces where the user can scroll dynamically to a specific row in a list box by entering the first letters of a value. In case where the list box cells are enterable, you can use the Is editing text command to know if the user is actually entering text in a cell or is using the type-ahead feature and then, execute appropriate code.

Sequência de teclas

When an entry requires a sequence of keystrokes, the On Before Keystroke and On After Keystroke events are generated only when the entry is fully validaded by the user. O comando Keystroke retorna o caractere validado. Este caso ocorre principalmente:

  • ao usar teclas "mortas", como ^ ou ~: eventos são gerados somente quando o caractere ampliado for inserido depois (por exemplo, "e├" ou n^\),
  • when an IME (Input method editor) displays an intermediary dialog box where the user can enter a combination of characters: events are generated only when the IME dialog is validated.

Veja também

On After Keystroke.