NUMLOCK( ) Function

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

NUMLOCK([lExpression])

Return Values

Logical

Parameters

  • lExpression
    Turns the NUM LOCK key on or off. If lExpression is true (.T.), the NUM LOCK key is turned on; if lExpression is false (.F.), the NUM LOCK key is turned off. NUMLOCK( ) returns a logical value corresponding to the NUM LOCK key setting before NUMLOCK(.T.) or NUMLOCK(.F.) is issued.

Remarks

NUMLOCK( ) returns true (.T.) if the NUM LOCK key is on (pressing a key on the numeric keypad returns a number), or false (.F.) if NUM LOCK is off (pressing a key on the numeric keypad moves the cursor).

Example

In the following example, the equal sign (=) is used to execute NUMLOCK( ) without returning a value.

gcOldLock = NUMLOCK( )  && Save original setting
WAIT WINDOW 'Press a key to turn Num Lock on'
= NUMLOCK(.T.)  && Turn Num Lock on
WAIT WINDOW 'Press a key to turn Num Lock off'
= NUMLOCK(!NUMLOCK( ))  && Toggle Num Lock to the opposite value
WAIT WINDOW 'Press a key to restore original Num Lock setting'
= NUMLOCK(gcOldLock)     && Return to original setting

See Also

CAPSLOCK( ) | INSMODE( )