Home > Archive > Clarion > December 2006 > Caps Lock and Num Lock
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Caps Lock and Num Lock
|
|
| ikonjevic 2006-12-14, 3:55 am |
| Hi,
i want add status of caps/num lock on status bar
of my application,
pleas help
ivica
| |
| Simon Kemp 2006-12-14, 6:55 pm |
|
ikonjevic wrote:
> Hi,
>
> i want add status of caps/num lock on status bar
> of my application,
>
> pleas help
>
> ivica
Hi,
api GetKeyState() will do this for you. Pasting in some code below
(will wrap I guess).
HTH,
Simon
PROGRAM
VK_CAPITAL EQUATE(20)
VK_NUMLOCK EQUATE(144)
VK_SCROLL EQUATE(145)
MAP
MODULE('User32')
GetKeyState(LONG nVirtKey),LONG,PASCAL,RAW
END
END
CODE
IF GetKeyState(VK_CAPITAL)
MESSAGE('CAPSLOCK ON')
ELSE
MESSAGE('CAPSLOCK OFF')
END
IF GetKeyState(VK_NUMLOCK)
MESSAGE('NUMLOCK ON')
ELSE
MESSAGE('NUMLOCK OFF')
END
| |
| Le vieux bandit 2006-12-14, 6:55 pm |
| Hello ivica,
You have to test some Keystate. Here is an example:
IF BAND(KEYSTATE(),2000h) !Test the state of the NUM
lock key
MenuWindow{Prop:StatusText,5} = 'Lock' !Its on
ELSE
MenuWindow{Prop:StatusText,5} = 'Unlock' !Its off
END
IF BAND(KEYSTATE(),1000h) !Test the state of the
CAPS lock key
MenuWindow{Prop:StatusText,6} = 'Lock' !Its on
ELSE
MenuWindow{Prop:StatusText,6} = 'Unlock' !Its off
END
IF BAND(KEYSTATE(),4000h) !Test the state of the
Scroll lock key
MenuWindow{Prop:StatusText,7} = 'Lock' !Its on
ELSE
MenuWindow{Prop:StatusText,7} = 'Unlock' !Its off
END
HTH,
Guy
> Hi,
>
> i want add status of caps/num lock on status bar
> of my application,
>
> pleas help
>
> ivica
| |
| Simon Kemp 2006-12-14, 6:55 pm |
| Hi Guy,
Live and learn :-)
How did keystate() pass me by ??
Thanks,
Simon
Le vieux bandit wrote:[color=darkred]
> Hello ivica,
>
> You have to test some Keystate. Here is an example:
>
> IF BAND(KEYSTATE(),2000h) !Test the state of the NUM
> lock key
> MenuWindow{Prop:StatusText,5} = 'Lock' !Its on
> ELSE
> MenuWindow{Prop:StatusText,5} = 'Unlock' !Its off
> END
> IF BAND(KEYSTATE(),1000h) !Test the state of the
> CAPS lock key
> MenuWindow{Prop:StatusText,6} = 'Lock' !Its on
> ELSE
> MenuWindow{Prop:StatusText,6} = 'Unlock' !Its off
> END
> IF BAND(KEYSTATE(),4000h) !Test the state of the
> Scroll lock key
> MenuWindow{Prop:StatusText,7} = 'Lock' !Its on
> ELSE
> MenuWindow{Prop:StatusText,7} = 'Unlock' !Its off
> END
>
>
> HTH,
> Guy
>
| |
| ikonjevic 2006-12-14, 6:55 pm |
| hi,
thanks a lot on your help, i put this code in embed point Windows Manager
- Restore from INI
!Divide status bar on 6 sections
0{Prop:Status,1} = 190
0{Prop:Status,2} = 125
0{Prop:Status,3} = 125
0{Prop:Status,4} = 125
0{Prop:Status,5} = 125
0{Prop:Status,6} = 125
!NUM lock key
IF BAND(KEYSTATE(),2000h) !Test the state of
the
0{Prop:StatusText,4} = 'Num Lock On' !Its on
ELSE
0{Prop:StatusText,4} = 'Num Lock Off' !Its off
END
!CAPS lock key
IF BAND(KEYSTATE(),1000h) !Test the state of
the
0{Prop:StatusText,5} = 'Caps Lock On' !Its on
ELSE
0{Prop:StatusText,5} = 'Caps Lock Off' !Its off
END
!SCROLL lock key
IF BAND(KEYSTATE(),4000h) !Test the state of
the
0{Prop:StatusText,6} = 'Scroll Lock On' !Its on
ELSE
0{Prop:StatusText,6} = 'Scroll Lock Off' !Its off
END
It works fine
Thanks a lot
Ivica
|
|
|
|
|