Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to change keys pressed in a TMemo Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
28-Aug-03
Category
Reporting /Printing
Language
Delphi 2.x
Views
128
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Christian Cristofori

When you insert an accented letter into a HTML it should be converted into an 
extended code for international use. 
That will help everyone who will build an HTML editor.

Answer:

Just add this to your memo keypress event: 
1   
2   procedure TForm1.Memo1KeyPress(Sender: TObject; var Key: Char);
3   const
4     UnSup =
5       #171#187#193#225#194#226#198#230#192#197#229#195#227#196#228#199#231#162#169#20 
6   +
7       #233#202#234#200#232#203#235#205#237#206#238#204#236#207#239#60#209#241#211#243 
8   +
9       #212#244#210#242#216#248#213#245#214#246#34#174#223#218#250#219#251#217#249#220 
10  +
11      #252#255;
12    Supported: array[0..61] of string =
13    (
14      '«', '»', 'Á', 'á',
15      'Â', 'â', 'Æ', 'æ',
16      'À', 'Å', 'å', 'Ã',
17      'ã', 'Ä', 'ä', 'Ç',
18      'ç', '¢', '©', 'É',
19      'é', 'Ê', 'ê', 'È',
20      'è', 'Ë', 'ë', 'Í',
21      'í', 'Î', 'î', 'Ì',
22      'ì', 'Ï', 'ï', '<',
23      'Ñ', 'ñ', 'Ó', 'ó',
24      'Ô', 'ô', 'Ò', 'ò',
25      'Ø', 'ø', 'Õ', 'õ',
26      'Ö', 'ö', '"', '®',
27      'ß', 'Ú', 'ú', 'Û',
28      'û', 'Ù', 'ù', 'Ü',
29      'ü', 'ÿ'
30      );
31  var
32    P: Integer;
33  begin
34    P := Pos(Key, UnSup);
35    if (P > 0) then
36    begin
37      Memo1.SetSelTextBuf(PChar(Supported[P - 1]));
38      Key := #0;
39    end;
40  end;


Obviously this can be ported to every type of char substitution. 

If you really use it I raccomend that you insert into the array all special symbols!

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC