Solved

Key parameter in OnKeyUp is wrong

Posted on 2002-06-24
5
774 Views
Last Modified: 2012-05-04
In a delphi OnKeyUp event, when I press the ';' on the keyboard the 'Key' parameter is set as 186 which corresponds to the character: 'º'. I have also noticed discrepencies with the ',' key. What's going on and how can I get find out accurately which key has been pressed?
0
Comment
Question by:Siband
  • 2
  • 2
5 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7103663
i guess that could
depend on the keyboardlayout- and/or countrysetting
of the os

do you have a special keyboardlayout and/or country setting?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7103689
next guess :-)

subtract just 127 from your value,
there may a flag set (bit 8?),
don't know the meaning at the moment
0
 

Author Comment

by:Siband
ID: 7103730
Subtracting 127 works for the ';' key but it doesn't work for the ',' key. A comma should be 44 but the value of Key is 188 in this case! I am not using a special keyboard as far as I know and my windows keyboard setting is 'English (United Kingdom)' which is correct.
0
 
LVL 11

Accepted Solution

by:
robert_marquardt earned 50 total points
ID: 7103886
This is the Scancode not the ASCII-Key. You will have to compare to the VK_ constants. They only correspond with ASCII for the alphanumeric keys.
0
 

Author Comment

by:Siband
ID: 7104019
Thanks, That cirtainly answered the question. I have only given a B grading because I still don't know where to find a comprehensive list of the VK_ constants. I had to poke around to find a few in the Windows.pas file but it was cirtainly not comprehensive and didn't contain the ones for ';' and ','. I thank you for pointing me in the right direction however.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question