Click or drag to resize

NumLock Function (Logic)

X#
Returns the current mode of the Num Lock key or sets the mode of the Num Lock key on or off.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION NumLock(
	lSetOn AS LOGIC
) AS LOGIC
Request Example View Source

Parameters

lSetOn
Type: Logic
Turns the Num Lock key on or off. If lSetOn is true (.T.), the Num Lock key is turned on; if lSetOn is false (.F.), the Num Lock key is turned off.

Return Value

Type: Logic
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).
Examples
X#
1gcOldLock = NumLock( )  // Save original setting
2WAIT 'Press a key to turn Num Lock on'
3= NumLock(.T.)  // Turn Num Lock on
4WAIT 'Press a key to turn Num Lock off'
5= NumLock(!NumLock( ))  // Toggle Num Lock to the opposite value
6WAIT 'Press a key to restore original Num Lock setting'
7= NumLock(gcOldLock)     // Return to original setting
See Also