Paradox Community

Items in pnews.paradox-development

Subject:Re: CAPS LOCK
Date:Sun, 11 Mar 2018 21:34:58 +0100
From:"modridirkac" <jure.zorko@gmail.com>
Newsgroups:pnews.paradox-development
You can get some information about Caps lock key directly with paradox:
method keyPhysical(var eventInfo KeyEvent)
    if eventInfo.vCharCode() = VK_CAPITAL then  ; if user presses Caps Lock
        view(1)
   endIf
endMethod

You can use virtual code VK:CAPITAL just as any other code (for example 
VK_RETURN)
But this will only get you the exact moment, user presses CapsLock key.

*********************

Next you can get info, if Caps Lock is ON, when user presses a letter:
proc isCapsLockDown(var eventInfo KeyEvent) logical
var ch string
    shift logical
endVar
    ch = eventInfo.char()
   ; if it is not a letter, then caps lock does not matter
   if lower(ch)<"a" or lower(ch)>"z" then return(false) endIf

   ; is Shift pressed?
   shift = eventInfo.isShiftKeyDown()

   if (lower(ch)=ch) and shift then
       ; user pressed "a" and Shift together,
      ; thus a letter should be "A", but because Caps Lock was ON,
      ; letter was "a"
       return(true)
   endIf
   if (upper(ch)=ch) and not shift then
       ; user pressed "A" and NO Shift
       return(true)
   endIf
    ; every other combination is with CAps OFF
   return(false)
endProc

**************************

But the easiest way would be to use user32.dl
uses user32
    GetKeyState(VirtKey clong) clong
endUSes

GetKeyState(VK_CAPITAL) returns 0 or 1.


*******************

Jure





"JI"  je napisal v sporońćilo news:5aa2e194$1@pnews.thedbcommunity.com ...

Is there any code that will sense a CAPS lock? 


Copyright © 2004 thedbcommunity.com