Solved

Convert (var Key: Word) to ASCII Character

Posted on 2009-05-08
10
4,675 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:SurferJoe
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
 
LVL 37

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 37

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:SurferJoe
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
delphi exception 7 63
Delphi 2 51
TServerSocket - file via sendbuf or Text via sendtext ? 1 43
Delphi...Split view - idea? 1 42
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…

867 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now