Hi there
This is driving me crazy.
I use Delphi 7.0 Enterpise (Build 4.453)
and Windows XP Professional Version 2002, Service Pack 2, greek version.
Please take a look at the following code.
The variable S, in Paint() method, is assigned a string
in greek language. I assume that any OEM string
is capable of reproducing the problem.
When running the program everything goes OK
until the Button1 is clicked.
After that the string on the form is not readable.
I suspected, at first, that something has changed to my machine,
something that has to do with how a system dialog box
which is displayed, affects WideStrings...
NOTE: this version of the code runs FINE in
Delphi 6.0 Enterprise (Build 6.240, Update Pack 2)
-------------------------------------------------------
type
TForm1 = class(TForm)
Button1: TButton;
SaveDialog1: TSaveDialog;
procedure Button1Click(Sender: TObject);
protected
procedure PaintText(const Text: WideString);
procedure Paint; override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Paint;
var
S : string;
begin
inherited Paint;
S := '?a'?n~a*o^a* E^u"o'i`a*'; { 'Hello World' in greek language }
PaintText(S);
end;
procedure TForm1.PaintText(const Text: WideString);
var
R : TRect;
Len : Integer;
begin
R := Rect(10, 10, 100, 100);
Len := Length(Text);
Windows.DrawTextExW(Canvas.Handle, PWideChar(Text), Len , R, DT_LEFT, nil);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SaveDialog1.Execute;
end;
-------------------------------------------------------
... then I altered the above code as in the following list.
No button, not dialog box.
But the result is still the same. That strange behavior.
The string is not readable.
NOTE: this second version of the code with
Delphi 6.0 Enterprise (Build 6.240, Update Pack 2)
has the same behavior as the Delphi 7 before.
-------------------------------------------------------
type
TForm1 = class(TForm)
protected
procedure Paint; override;
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Paint;
var
S : string;
R : TRect;
Len : Integer;
begin
inherited Paint;
S := '?a'?n~a*o^a* E^u"o'i`a*'; { 'Hello World' in greek }
R := Rect(10, 10, 100, 100);
Len := Length(Text);
Windows.DrawTextExW(Canvas.Handle, PWideChar(Text), Len , R, DT_LEFT, nil);
end;
-------------------------------------------------------
Could please any of you who has an OEM version of Windows
check those samples in his/her machine and report the results to me?
Have you any clue of what is happening here?
I noticed that problem for the first time
when a coworker of mine sent me a file
using Skype. I use a greek version of Skype.
After receiving the file in the Skype and clicking on the Save
button of the Save file dialog box, in Skype,
its menus, in the menu bar, turned out to unreadable strings
just like my Delphi samples with the DrawTextExW() demo.
I now changed the language of the Skype to english.
Please help. I'm trying to avoid a format/install here.
--
Regards
Theo
------------------------
Theo Bebekis
Thessaloniki, Greece
------------------------
Greek_Delphi_Prog : a Delphi Programming mailing list in Greek at
http://groups.yahoo.com/group/Greek_Delphi_Prog
CSharpDotNetGreek : A C# and .Net mailing list in Greek language at
http://groups.yahoo.com/group/CSharpDotNetGreek
atla_custom : a Unisoft Atlantis Customization mailing list at
http://groups.yahoo.com/group/atla_custom
------------------------
------------------------------------
-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/delphi-en/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/delphi-en/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/