Highlighted
Alex_Castro Respected Contributor.
Respected Contributor.
69 views

Detecting Caps Lock and other Function Keys in WinForm

Jump to solution

Is there a command to detect whether the Caps lock, Num lock, or the Insert key are on in managed COBOL? The command in C# is something like:

 

if (Control.IsKeyLocked(Keys.CapsLock))

    do something

end if.

 

The following command in managed COBOL only detect whether the keys were pressed but does not detect whether the caps lock is on:

 

if e::KeyCode = type Keys::CapsLock

    do something

end-if.

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Detecting Caps Lock and other Function Keys in WinForm

Jump to solution

You can check this using the same syntax as the C# snippet

if type Control::IsKeyLocked(type Keys::CapsLock)
   display "caps on"
else
   display "caps off"
end-if
2 Replies
Micro Focus Expert
Micro Focus Expert

Re: Detecting Caps Lock and other Function Keys in WinForm

Jump to solution

You can check this using the same syntax as the C# snippet

if type Control::IsKeyLocked(type Keys::CapsLock)
   display "caps on"
else
   display "caps off"
end-if
Alex_Castro Respected Contributor.
Respected Contributor.

Re: Detecting Caps Lock and other Function Keys in WinForm

Jump to solution
That worked, thank you!
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.