Partager via


CAPSLOCK( ) Function

Returns the current mode of the CAPS LOCK key or sets the CAPS LOCK key mode on or off.

CAPSLOCK([lExpression])

Return Values

Logical

Parameters

  • lExpression
    Include to turn the CAPS LOCK key on or off. CAPSLOCK(.T.) turns CAPS LOCK on and CAPSLOCK(.F.) turns CAPS LOCK off. A logical value is returned corresponding to the CAPS LOCK setting before CAPSLOCK(.T.) or CAPSLOCK(.F.) is issued.

Remarks

Issuing CAPSLOCK( ) with no argument returns true (.T.) if CAPS LOCK is on, or false (.F.) if CAPS LOCK is off.

Example

The following code stores the state of CAPSLOCK( ) to a system variable. The = command executes the CAPSLOCK( ) function to set CAPS LOCK on. Then the = command executes the CAPSLOCK( ) function to set CAPS LOCK to its previous state.

glOldLock = CAPSLOCK( )     && Save original setting
= CAPSLOCK(.T.)     && Turn CAPS LOCK on

** Perform any number of statements **

= CAPSLOCK(glOldLock)  && Return to original setting

** or, toggle CapsLock to the opposite value and back **

= CAPSLOCK(!CAPSLOCK( ))
WAIT WINDOW
= CAPSLOCK(!CAPSLOCK( ))
WAIT WINDOW
= CAPSLOCK(glOldLock)  && Return to original setting

See Also

INSMODE( ) | NUMLOCK( ) | = Command