Solved

Convert (var Key: Word) to ASCII Character

Posted on 2009-05-08
10
4,846 Views
Last Modified: 2012-05-06
FormKeyDown(Sender: TObject; var Key: Word;  Shift: TShiftState);

There has to be an easy way to  convert (Key) to the ASCII equivalent?
Something like;
  var
    s: String;
   
    s := WordToStr(Key);

Brain Dead........

0
Comment
Question by:Greg Rowland
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 425 total points
ID: 24336054
Char(Key), perhaps?
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 425 total points
ID: 24336075
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  if ssShift in Shift then
    ShowMessage(Char(Key))
  else
    ShowMessage(LowerCase(Char(Key)));
end;
0
 
LVL 5

Assisted Solution

by:louislietaer
louislietaer earned 25 total points
ID: 24336272
No

Chr(Key) will give a char (see also ord() function)

Char will cast the word, I will not recommend.

you could use it like that

if (chr(Key)='a') or (chr(key)='A') then
begin
  ...
end
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 50 total points
ID: 24336407
this is a virtual key you are getting
check the VK_ constants in the windows unit

ciuly created a small unit to create such a unit once for me:
http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_23823866.html

that time it was for the messages.
0
 
LVL 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 50 total points
ID: 24908704
>> Never did get any of this to meet my needs, please close question.

you haven't even posted a remark

this is not just ask a question and wait for an answer
if you see you aren't getting anywhere then post some more info
or react on the comments
0
 
LVL 26

Assisted Solution

by:EddieShipman
EddieShipman earned 425 total points
ID: 24908870
I agree, you were given several correct answers to your question on how to convert the word in a KeyDown to a character.

You must select one or more as the answer, dude!
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24909241
modus, why did you select an answer?
0
 
LVL 4

Author Comment

by:Greg Rowland
ID: 24909371
I selected an answer as I  could not bear the complaints.
0
 
LVL 26

Expert Comment

by:EddieShipman
ID: 24909675
It would have been easier to tell us what about the posted solutions didn't work for you than to try to delete the question without an explanation. As I said earlier, you were given several correct answers to your question and you were expected to select one or more.

If you'd been more upfront with us, there would have not been any complaints.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses
Course of the Month11 days, 16 hours left to enroll

623 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