Page 1 of 1

Field DisplayLabel when assigning datasets, Question.

Posted: Tue 09 Feb 2010 10:09
by m227
Hello once more.

I met following problem. When I assign one VT to another, the property of DisplayLabel isn't copied. So such code can produce different results:

Code: Select all

  V2 := TVirtualTable.Create(Self);
  V2.Assign(V1);
  ShowMessage( V1.FieldByName('anyfield').DisplayLabel );
  ShowMessage( V2.FieldByName('anyfield').DisplayLabel );
I presume it is some limitation of assigning or even it is obvious behaviour if only table data is copied. The question is, if there is a simple solution to copy DisplayLabel fields property instead of code:

Code: Select all

procedure CopyDisplayLabels(ds1, ds2: TDataSet);
var
  i: Integer;
begin
  for i := 0 to ds1.FieldCount - 1 do
    ds2.Fields[i].DisplayLabel := ds1.Fields[i].DisplayLabel
end;

Posted: Fri 24 Sep 2010 06:56
by AndreyZ
Hello,

This is correct behaviour of the TVirtualTable component. You should copy the DisplayLabel property manually.