Hello,
Is there any way to find out whether the caps lock indicator is on?
This is useful for login screens.
regards,
Sotiris
Caps Lock indicator?
-
JamesDuignan
- Posts: 85
- Joined: Thu Nov 26, 2015 1:43 pm
Re: Caps Lock indicator?
Hi Soritos,
The easiest method to do this would be putting some simple logic into the keypress event of a the input field.
The checks are something like
1. If shift is down and the character is lowercase caps lock is on.
2. If shift isn't down and character is uppercase caps lock is on.
3. If shift is down and the character is uppercase caps lock is off.
4. If shift isn't down and character is lowercase caps lock is off.
Something along the lines of:
Regards,
James
The easiest method to do this would be putting some simple logic into the keypress event of a the input field.
The checks are something like
1. If shift is down and the character is lowercase caps lock is on.
2. If shift isn't down and character is uppercase caps lock is on.
3. If shift is down and the character is uppercase caps lock is off.
4. If shift isn't down and character is lowercase caps lock is off.
Something along the lines of:
Code: Select all
Begin_Com Role(*EXTENDS #PRIM_WEB)
Define_Com Class(#PRIM_MD.Edit) Name(#Edit) Caption('Caption') Displayposition(1) Left(80) Parent(#COM_OWNER) Tabposition(1) Top(40) Width(441) Passwordchar('*')
Evtroutine Handling(#Edit.KeyPress) Isshiftdown(#ShiftDown) Char(#Char)
If (#Char <> *BLANKS)
If ((#ShiftDOWN) *And (#Char.LowerCase = #Char) *Or (*Not #ShiftDOWN) *And (#Char.UpperCase = #Char))
#Edit.HelperColor := 'Red'
#Edit.HelperText := 'Caps lock is on'
Endif
If ((#ShiftDOWN) *And (#Char.UpperCase = #Char) *Or (*Not #ShiftDOWN) *And (#Char.LowerCase = #Char))
#Edit.HelperColor := 'Green'
#Edit.HelperText := 'Caps lock is off'
Endif
Endif
Endroutine
End_Com
James