77 |
|
private |
78 |
|
FKeyValue: variant; |
79 |
|
public |
80 |
+ |
constructor Create(AnOwner: TTreeNodes); override; |
81 |
|
procedure DeleteAll; |
82 |
|
property KeyValue: variant read FKeyValue; |
83 |
|
end; |
135 |
|
{ Public declarations } |
136 |
|
constructor Create(TheComponent: TComponent); override; |
137 |
|
destructor Destroy; override; |
138 |
< |
function FindNode(KeyValuePath: array of variant; SelectNode: boolean): TIBTreeNode; overload; |
138 |
> |
function FindNode(KeyValuePath: TVariantArray; SelectNode: boolean): TIBTreeNode; overload; |
139 |
|
function FindNode(KeyValue: variant): TIBTreeNode; overload; |
140 |
|
function GetNodePath(Node: TTreeNode): TVariantArray; |
141 |
|
property DataSet: TDataSet read GetDataSet; |
302 |
|
|
303 |
|
{ TIBTreeNode } |
304 |
|
|
305 |
+ |
constructor TIBTreeNode.Create(AnOwner: TTreeNodes); |
306 |
+ |
begin |
307 |
+ |
inherited Create(AnOwner); |
308 |
+ |
FKeyValue := NULL; |
309 |
+ |
end; |
310 |
+ |
|
311 |
|
procedure TIBTreeNode.DeleteAll; |
312 |
|
var Node, NextNode: TTreeNode; |
313 |
|
begin |
508 |
|
if Result then |
509 |
|
begin |
510 |
|
if DataSet.Active and (DataSet.RecordCount > 0) |
511 |
< |
and (Node.KeyValue = DataSet.FieldByName(KeyField).AsVariant) then Exit; |
511 |
> |
and DataSet.Locate(KeyField,Node.KeyValue,[]) then Exit; |
512 |
|
|
513 |
|
FUpdateNode := Node; |
514 |
|
try |
694 |
|
inherited Destroy; |
695 |
|
end; |
696 |
|
|
697 |
< |
function TIBTreeView.FindNode(KeyValuePath: array of variant; |
698 |
< |
SelectNode: boolean): TIBTreeNode; |
697 |
> |
function TIBTreeView.FindNode(KeyValuePath: TVariantArray; SelectNode: boolean |
698 |
> |
): TIBTreeNode; |
699 |
|
var Node: TTreeNode; |
700 |
|
i,j: integer; |
701 |
|
begin |
702 |
|
Result := nil; |
703 |
+ |
if Length(KeyValuePath) = 0 then Exit; |
704 |
+ |
|
705 |
|
FLocatingNode := true; |
706 |
|
try |
707 |
|
for j := 0 to Items.TopLvlCount - 1 do |
711 |
|
Node.Expand(false); |
712 |
|
while assigned(Node) do |
713 |
|
begin |
714 |
< |
if TIBTreeNode(Node).KeyValue = KeyValuePath[i] then |
714 |
> |
if not VarIsNull(TIBTreeNode(Node).KeyValue) and |
715 |
> |
(TIBTreeNode(Node).KeyValue = KeyValuePath[i]) then |
716 |
|
begin |
717 |
|
Inc(i); |
718 |
|
if i = Length(KeyValuePath) then |