Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Convert (var Key: Word) to ASCII Character

Posted on 2009-05-08
10
Medium Priority
?
4,914 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 1700 total points
ID: 24336054
Char(Key), perhaps?
0
 
LVL 26

Accepted Solution

by:
EddieShipman earned 1700 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 100 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 38

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 200 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 200 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 1700 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

715 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