Implemented unicode support for TStrings based controls under Windows.

git-svn-id: trunk@11610 -
This commit is contained in:
sekelsenmat 2007-07-24 08:50:07 +00:00
parent 652b5a43ec
commit 23cfb3f41c

View File

@ -128,7 +128,17 @@ var
begin begin
For Counter := 0 To TheStrings.Count - 1 Do For Counter := 0 To TheStrings.Count - 1 Do
Begin Begin
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(TheStrings[Counter]))); //Insert {$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0,
LPARAM(PWideChar(Utf8Decode(TheStrings[Counter])))) //Insert
else
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0,
LPARAM(PChar(Utf8ToAnsi(TheStrings[Counter])))); //Insert
{$else}
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0,
LPARAM(PChar(TheStrings[Counter]))); //Insert
{$endif}
PutObject(AnIndex, TheStrings.Objects[Counter]); PutObject(AnIndex, TheStrings.Objects[Counter]);
end; end;
end; end;
@ -218,14 +228,32 @@ End;
Returns: Returns:
------------------------------------------------------------------------------} ------------------------------------------------------------------------------}
Procedure TWin32ListStringList.Insert(Index: Integer; Const S: String); procedure TWin32ListStringList.Insert(Index: Integer; Const S: String);
Begin begin
FLastInsertedIndex := Index; FLastInsertedIndex := Index;
If FSorted Then if FSorted then
FLastInsertedIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(S))) begin
Else {$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
FLastInsertedIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PWideChar(Utf8Decode(S))))
else
FLastInsertedIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(Utf8ToAnsi(S))));
{$else}
FLastInsertedIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(S)));
{$endif}
end
else
begin
{$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then
Windows.SendMessage(FWin32List, FFlagInsertString, Index, LPARAM(PWideChar(Utf8Decode(S))))
else
Windows.SendMessage(FWin32List, FFlagInsertString, Index, LPARAM(PChar(Utf8ToAnsi(S))));
{$else}
Windows.SendMessage(FWin32List, FFlagInsertString, Index, LPARAM(PChar(S))); Windows.SendMessage(FWin32List, FFlagInsertString, Index, LPARAM(PChar(S)));
End; {$endif}
end;
end;
procedure TWin32ListStringList.Put(Index: integer; const S: string); procedure TWin32ListStringList.Put(Index: integer; const S: string);
var var