Einzelnen Beitrag anzeigen

Bjoerk

Registriert seit: 28. Feb 2011
Ort: Mannheim
1.384 Beiträge
 
Delphi 10.4 Sydney
 
#1

Exception bei VST.EndUpdate (TVirtualStringTree).

  Alt 22. Dez 2014, 13:47
Hab keine Ahnung wieso?

Delphi-Quellcode:
procedure TSomeForm.AssignToVST(Grid: TGrid);
var
  I, J: integer;
  Data: PVstNodeData;
  Node, Temp: PVirtualNode;
begin
  if (Grid.RowCount > 0) and (Grid.ColCount > 0) then
  begin
    VST.BeginUpdate;
    try
      VST.Clear;
      for I := 0 to Grid.RowCount - 1 do
      begin
        Node := VST.AddChild(Nil);
        Data := VST.GetNodeData(Node);
        Data.Caption := Grid.Cells[I, 0];
        Data.Row := I;
        Data.Col := 0;
        for J := 1 to Grid.ColCount - 1 do
        begin
          Temp := VST.AddChild(Node);
          Data := VST.GetNodeData(Temp);
          Data.Caption := Grid.Cells[I, J];
          Data.Row := I;
          Data.Col := J;
        end;
      end;
    finally
      VST.EndUpdate;
    end;
  end;
end;
  Mit Zitat antworten Zitat