Sign in Join
FPDoc Onlineexperiment

IsAccel function

In unit Forms

Determines whether the specified virtual key is used as an accelerator (short cut) in the given caption string.

Declaration

pascal
function IsAccel(VK: Word; const Str: string): Boolean

Arguments

VK

The virtual key (uppercase ASCII) to find.

Str

The string to scan.

Function result

True when the key is used as an accelerator.

Description

An accelerator consists of an ampersand followed by the accelerator key. Duplicate ampersands are ignored; they denote a literal (displayed) ampersand character (&).

IsAccel calls UTF8Pos to locate all occurrences of a single Ampersand character in Str. The character immediately following the Ampersand is the short cut character for the accelerator, and it is compared to the numeric value in VK. If one of the short cut characters matches the value in VK, the return value is set to True and the routine is exited. If none of the short cut characters match VK, or an accelerator is not present in Str, the return value is False.

IsAccel is called from controls which implement overridden CMDialogChar or DialogChar methods. It is also called when widgetset classes handle menu item selection and execution in an application.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.