Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Changing the charset of a hint doesn't work under Win98SE

Posted on 2007-10-16
11
Medium Priority
?
432 Views
Last Modified: 2010-04-05
Hello folks,

I tried to change the charset of a hint in the following three ways:

(1)
Screen.HintFont.Charset := TURKISH_CHARSET;

(2)
constructor TTurkishHintWindow.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Canvas.Font.Charset := TURKISH_CHARSET;
end;

(3)
procedure TForm1.MyShowHint(var HintStr: string;
  var CanShow: Boolean;
  var HintInfo: THintInfo);
var
  i : integer;
begin
  for i := 0 to Application.ComponentCount - 1 do
  if Application.Components[i] is THintWindow then
    THintWindow(Application.Components[i]).Canvas.Font.Charset := TURKISH_CHARSET;
end;


On other systems (e.g. Win2000, XP, Vista) every code changes the charset the right way.
Is it just not possible to change it under Win98SE? Or do I miss some special code piece for that?

Regards
0
Comment
Question by:Acrklor
  • 5
  • 4
10 Comments
 
LVL 1

Expert Comment

by:wavget
ID: 20085800
Windows 98 is not unicode aware, so maybe it doesn't know the character set?

http://www.microsoft.com/downloads/details.aspx?FamilyId=73BA7BD7-ED06-4F0D-80A4-2A7EEAEE17E2&displaylang=en
0
 
LVL 2

Author Comment

by:Acrklor
ID: 20085958
I don't think that is the problem, because I already changed the charset of other components (for example Button, Label, Panel, ListBox...) succesfully under Win98SE.
0
 
LVL 1

Expert Comment

by:wavget
ID: 20086056
I did some searching and it seems THintWindow uses String and not WideString, so no unicode.
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 2

Author Comment

by:Acrklor
ID: 20086297
I don't need WideStrings and I don't use them anywhere in my program. So you meen even if my program doesn't use WideStrings at all (and therefore don't need unicode) the components need to convert the Strings to WideStrings in the background to display another charset than for example ANSI_CHARSET?
If yes why does it work under Win2000, XP and Vista?
And why does charset change work with a TPanel, because the VCL works there also with "Caption: string" and pass it on to the API with "PChar(Caption)".

Thanks for the provided links, but they work with WideStrings and I have none. Or do you suggest to an own Hint class with them?
0
 
LVL 1

Expert Comment

by:wavget
ID: 20086586
From what I understand THintWindow uses this to paint the text:

DrawText(Canvas.Handle, PChar(Caption), -1, R, DT_LEFT or DT_NOPREFIX or DT_WORDBREAK or DrawTextBiDiModeFlagsReadingOnly);

Maybe the issue is that it uses PChar to convert the caption?

"The fundamental types PAnsiChar and PWideChar represent pointers to AnsiChar and WideChar values, respectively. The generic PChar represents a pointer to a Char (that is, in its current implementation, to an AnsiChar)."
0
 
LVL 2

Author Comment

by:Acrklor
ID: 20086638
If this is the issue, why does the code from TPanel work on Win98SE:

Flags := DT_EXPANDTABS or DT_VCENTER or Alignments[FAlignment];
Flags := DrawTextBiDiModeFlags(Flags);
DrawText(Handle, PChar(Caption), -1, Rect, Flags);

This one also uses PChar to convert the Caption, therefore TPanel wouldn't work either if the PChar-thing is the problem, would it?
0
 
LVL 2

Author Comment

by:Acrklor
ID: 20101456
Thanks for trying, wavget, but finally I found the solution with a colleague in another direction.
The solution is trivial and when I think about it, it seems quite embarrassing asking for that. o_O

Adding to the first way with the HintFont one line to this:

Screen.HintFont.Name := 'Tahoma';
Screen.HintFont.Charset := TURKISH_CHARSET;

and now it works fine on Win98SE up to Vista. I don't know why, because the HintFont.Name is already "Tahoma", so I guess creating the ressource again solves somehow some problem under Win98SE leading to this strange effect.
0
 
LVL 2

Author Comment

by:Acrklor
ID: 20101501
I forgot, can a Moderator please close this one as I found the solution myself and provide wavget with 50 points (or so) for trying?

Thanks in advance and regards
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 21216668
PAQed with points refunded (250)

Computer101
EE Admin
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses
Course of the Month20 days, 16 hours left to enroll

810 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