CAPSLOCK( ) Function 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