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; |
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; |