ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/public/ibx/branches/journaling/ibcontrols/IBTreeView.pas
(Generate patch)

Comparing ibx/trunk/ibcontrols/IBTreeView.pas (file contents):
Revision 271 by tony, Fri Mar 16 10:27:26 2018 UTC vs.
Revision 272 by tony, Mon Feb 4 13:34:37 2019 UTC

# Line 367 | Line 367 | begin
367          if (FExpandNode = nil) or (TIBTreeNode(FExpandNode).KeyValue <> DataSet.FieldByName(KeyField).AsVariant) then
368          begin
369            Node := Items.AddChild(FExpandNode,DataSet.FieldByName(TextField).AsString);
370          if ImageIndexField <> '' then
371            Node.ImageIndex := DataSet.FieldByName(ImageIndexField).AsInteger;
372          if SelectedIndexField <> '' then
373            Node.SelectedIndex := DataSet.FieldByName(SelectedIndexField).AsInteger;
374          TIBTreeNode(Node).FKeyValue := DataSet.FieldByName(KeyField).AsVariant;
370            Node.HasChildren := (HasChildField = '') or (DataSet.FieldByName(HasChildField).AsInteger <> 0);
371            Inc(ChildCount);
372          end;
# Line 616 | Line 611 | end;
611  
612   procedure TIBTreeView.Added(Node: TTreeNode);
613   begin
614 <  if assigned(DataSet) and DataSet.Active and not FNoAddNodeToDataset then
614 >  if assigned(DataSet) and DataSet.Active then
615    begin
616 <    DataSet.Append;
616 >    if not FNoAddNodeToDataset then
617 >    begin
618 >      DataSet.Append;
619 >      if (Node.Text = '') and not DataSet.FieldByName(TextField).IsNull then
620 >         Node.Text := DataSet.FieldByName(TextField).AsString;
621 >      FModifiedNode := TIBTreeNode(Node);
622 >      FDataLink.UpdateRecord;
623 >    end;
624      TIBTreeNode(Node).FKeyValue := DataSet.FieldByName(KeyField).AsVariant;
625 <    if (Node.Text = '') and not DataSet.FieldByName(TextField).IsNull then
626 <       Node.Text := DataSet.FieldByName(TextField).AsString;
627 <    FModifiedNode := TIBTreeNode(Node);
628 <    FDataLink.UpdateRecord
625 >    if ImageIndexField <> '' then
626 >      Node.ImageIndex := DataSet.FieldByName(ImageIndexField).AsInteger;
627 >    if SelectedIndexField <> '' then
628 >      Node.SelectedIndex := DataSet.FieldByName(SelectedIndexField).AsInteger;
629    end;
630    inherited Added(Node);
631   end;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines