ZedDBTreeView - issue lazarus / 16-Databases ---------------------------------------------------------------------- Snoopy_jb · 2013-09-02 10:15 Hi, this component is really great but I found some issue. When my table is empty, everything is ok. When table has some data - parent node, more child nodes etc. it's still ok. But when my table has only one node (parent node) without any child nodes, my program crashes and shows error in this section: Code: [Select](******************************************************* *********************** * Synchronize the tree with database after adding a row directly into DB. ********************************************************************** *********) procedure TZedDBTreeView.CheckAppend; var   Node : TZedTreeNode; begin   if (DatasetAvailable) and ((FTextDataLink.DataSet.RecordCount - Self.Items.Count) = 1) then     begin       Self.BeginUpdate;       try        Node := Self.Items.AddNewChild(GetNodeByID(FParentDataLink.Field.AsInteger), FTextDataLink.Field.AsString);         Node.ID := FTextDataLink.DataSet.FieldByName(FIDField).AsInteger;         Node.ParentID := FParentDataLink.Field.AsInteger;       finally         Self.EndUpdate;       end;     end; end; My table looks like this: id pid name main root node has pid field as null. ---------------------------------------------------------------------- magno.gst · 2014-01-01 00:56 Hi. I registered just to answer your call. I had that problem, resolved by correcting the ZedDBTreeView.CheckAppend method as below. Code: [Select] procedure TZedDBTreeView.CheckAppend; var   Node      : TZedTreeNode;   ParentNode: TZedTreeNode; begin   if (DatasetAvailable) and ((FTextDataLink.DataSet.RecordCount - Self.Items.Count) = 1) then     begin       Self.BeginUpdate;       try         ParentNode := nil;         if Assigned(FParentDataLink.Field) then         begin               ParentNode := GetNodeByID(FParentDataLink.Field.AsInteger);         end;         Node := Self.Items.AddNewChild(ParentNode, FTextDataLink.Field.AsString);         Node.ID := FTextDataLink.DataSet.FieldByName(FIDField).AsInteger;         Node.ParentID := -1;         if Assigned(FParentDataLink.Field) then         begin               Node.ParentID := FParentDataLink.Field.AsInteger;         end;       finally         Self.EndUpdate;       end;     end; end;  I attached the fixed zeddbtreeview.pas. Cheers o/ ---------------------------------------------------------------------- eldonfsr · 2024-08-02 19:13 where i can find zedtreeview requiered by ths component ---------------------------------------------------------------------- paweld · 2024-08-02 19:27 @eldonfsr: https://code.google.com/archive/p/zeddbtreeview/downloads ---------------------------------------------------------------------- eldonfsr · 2024-08-03 17:18 Thanks let me learn litte more about dbtree..