Click or drag to resize

NumLock Function

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.21
Syntax
 FUNCTION NumLock() AS LOGIC
Request Example View Source

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