fix for TWin32ListStringList to preserve special chars and status on assign operation

git-svn-id: trunk@10233 -
This commit is contained in:
jesus 2006-11-22 23:56:03 +00:00
parent 3f883b4f36
commit a4664b8977
2 changed files with 12 additions and 24 deletions

View File

@ -125,36 +125,24 @@ Begin
RecreateWnd(FSender);
End;
{------------------------------------------------------------------------------
Method: TWin32ListStringList.Assign
Method: TWin32ListStringList.AddStrings
Params:
Returns:
------------------------------------------------------------------------------}
Procedure TWin32ListStringList.Assign(Source: TPersistent);
Var
S: TStrings;
procedure TWin32ListStringList.AddStrings(TheStrings: TStrings);
var
Counter: Integer;
AnIndex: Integer;
Begin
{ Do not call inherited Assign as it does things we do not want to happen }
If Source Is TStrings Then
AnIndex: LongInt;
begin
For Counter := 0 To TheStrings.Count - 1 Do
Begin
S:= TStrings(Source);
QuoteChar:=S.QuoteChar;
Delimiter:=S.Delimiter;
NameValueSeparator:=S.NameValueSeparator;
Windows.SendMessage(FWin32List, FFlagResetContent, 0, 0);
For Counter := 0 To (TStrings(Source).Count - 1) Do
Begin
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(S[Counter]))); //Insert
PutObject(AnIndex, S.Objects[Counter]);
end;
End
Else
inherited Assign(Source);
End;
AnIndex := Windows.SendMessage(FWin32List, FFlagAddString, 0, LPARAM(PChar(TheStrings[Counter]))); //Insert
PutObject(AnIndex, TheStrings.Objects[Counter]);
end;
end;
{------------------------------------------------------------------------------
Method: TWin32ListStringList.Add

View File

@ -61,7 +61,7 @@ Type
Procedure SetSorted(Val: Boolean); Virtual;
Public
Constructor Create(List : HWND; TheOwner: TWinControl);
Procedure Assign(Source: TPersistent); Override;
procedure AddStrings(TheStrings: TStrings); override;
Procedure Clear; Override;
Procedure Delete(Index: Integer); Override;
Procedure Insert(Index: Integer; Const S: String); Override;