Solved

How can I have my Delphi 5 app able to let chinese characters be entered

Posted on 2002-05-31
6
442 Views
Last Modified: 2007-12-19
Hi,

How can I have my Delphi 5 app able to support users entering Chinese characters and other "difficult" languages?

I have heard about that Unicode components may be needed but I don't know of a good replacement set of replacement components (TEdit, TMemo, TLabel, etc).  I don't want to rewrite my app to make it able to do this.

However, I found something on the Borland web site which suggests that Delphi 6 can do this:

http://community.borland.com/article/0,1410,28189,00.html

If Delphi 5 can't display asian characters, what use would be the IMEMode, IMEName and BiDiMode?

Have had a lot of trouble finding useful information about this on the Internet.

Help!

Thanks,
MP
0
Comment
Question by:mikepj
[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
6 Comments
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 200 total points
ID: 7048427
0
 

Expert Comment

by:sunrains
ID: 7048629
intersted,too!
r u chinese?
which city ?
0
 
LVL 2

Author Comment

by:mikepj
ID: 7048852
Nope; not Chinese; we only speak English here!

Will look at the unicode address
0
Industry Leaders: 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 1

Expert Comment

by:pnh73
ID: 9010400
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept answer from mnasman

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 1

Expert Comment

by:pnh73
ID: 9010967
Thank you for your response

Paul (pnh73)
EE Cleanup Volunteer
0
 
LVL 2

Author Comment

by:mikepj
ID: 14118198
for sure this works with delphi 5 and later.  probably from delphi 3 onwards.  it seems to work famously!  have tried it with chinese windows.  if you use a copy of windows that is not on its primary language, it doesn't behave quite right.  haven't found a solution to that yet.

// added this to each form's .pas file:
uses
  ...., uLanguage;

called the following sometime before form is shown:

    FormLanguageInit(self);

// add this .pas file to your project
unit uLanguage;

interface

uses
  windows, forms, sysutils, graphics;

procedure FormLanguageInit(frm:TForm);
procedure FrameLanguageInit(fra:TFrame);

implementation

type
 TLanguage = 0..$FFFF;

// delphi-supplied api call header is supposedly incorrect
function TranslateCharsetInfo(lpSrc: Pointer; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; external gdi32;

function CodePageFromLocale(Language: TLanguage): Integer;
var
  Buf: array[0..6] of Char;
begin
  GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6);
  Result:= StrToIntDef(Buf, GetACP);
end;

function CharSetFromLocale(Language: TLanguage): TFontCharSet;
var
  CP: Integer;
  CSI: TCharsetInfo;
begin
  CP:= CodePageFromLocale(Language);
  TranslateCharsetInfo(Pointer(CP), CSI, TCI_SRCCODEPAGE);
  Result:= CSI.ciCharset;
end;

procedure FormLanguageInit(frm:TForm);
begin
  frm.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  
end;

procedure FrameLanguageInit(fra:TFrame);
begin
  fra.Font.Charset:=CharSetFromLocale(SysLocale.PriLangID);  end;

end.
0

Featured Post

Technology Partners: 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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
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…

726 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