Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

Big Bug in TLMDUnicodeStrings AssignTo-Methode

If LineBreak is different to CRLF, the code fail to assign to VCL TStrings.
I've fixed this by saving old value of LineBreak and set it to default-value

procedure TLMDWideStrings.AssignTo(Dest: TPersistent);
var
  i: integer;
  OldLineBreak: LineBreak;
begin
  if Dest is TLMDWideStrings then
  begin
    Dest.Assign(Self)
  end
  else
  if Dest is TStrings then
  begin
    OldLineBreak := LineBreak;
    case DefaultTextLineBreakStyle of
      tlbsLF:   FLineBreak := #10;
      tlbsCRLF: FLineBreak := #13+#10;
    else
      Assert(false);
    end;

    TStrings(Dest).BeginUpdate;
    try
      TStrings(Dest).Text := Text;
      for i := 0 to Count - 1 do
      begin
        if TStrings(Dest).Count < Count then
          TStrings(Dest).Add('');
        TStrings(Dest).Objects[i] := Objects[i];
      end;
    finally
      TStrings(Dest).EndUpdate;
      LineBreak := OldLineBreak;
    end;
    exit;
  end
  else
    inherited;
end;


Comments

Sign In or Register to comment.