Einzelnen Beitrag anzeigen

Headbucket

Registriert seit: 12. Dez 2013
Ort: Dresden
172 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#3

AW: Daten-Rekord zu TreeView hinzufügen - Problem/AV

  Alt 2. Nov 2016, 10:11
In welcher Zeile tritt denn die access violation auf?
Mir ist aufgefallen, dass bei deiner AddVSTStructure Methode der Aufruf von ValidateNode fehlt. Aber das hat nichts mit der access violation zu tun... .

Das ganze sollte jedoch so aussehen:
Delphi-Quellcode:
function AddVSTStructure(AVST: TCustomVirtualStringTree; ANode: PVirtualNode; ARecord: TTreeData): PVirtualNode;
var
  Data: PTreeData;
begin
  Result:=AVST.AddChild(ANode);
  Data:=AVST.GetNodeData(Result);
  Avst.ValidateNode(Result, False);
  Data^.FCaption:=ARecord.FCaption;
end;
Zitat:
The method ValidateNode will initialise the nodes. This is important at the freeing of the data, because otherwise the data will be released into the memory. The first parameter
must be the node you want to initialise, the second if you also want to initialise its children.
Wie sieht denn deine GetText-Methode des VST aus?

Grüße
Headbucket
  Mit Zitat antworten Zitat