Вот исходник:
Цитата:
Собствено сабж
Цитата:
procedure TDialogBenutzer.RefreshTreeView;
var
lRootNode : TTreeNode;
lWasExpanded : Boolean;
begin
trvMain.Items.BeginUpdate;
try
mDataSecurity.SetNoFilter;
lRootNode := trvMain.Items.GetFirstNode;
lWasExpanded := lRootNode.Expanded;
lRootNode.DeleteChildren;
mDataSecurity.qryABT_DLG.First;
while not(mDataSecurity.qryABT_DLG.EOF) do begin
trvMain.Items.AddChildObject(lRootNode, mDataSecurity.qryABT_DLGabt_name.AsString, TAbteilung.Create(mDataSecurity.qryABT_DLGabt_id.AsFloat, mDataSecurity.qryABT_DLGabt_name.AsString, mDataSecurity.qryABT_DLGabt_mc.AsString));
mDataSecurity.qryABT_DLG.Next;
end;
lRootNode.Expanded := lWasExpanded;
lRootNode := lRootNode.getNextSibling;
lWasExpanded := lRootNode.Expanded;
lRootNode.DeleteChildren;
mDataSecurity.qryBEN_DLG.First;
while not(mDataSecurity.qryBEN_DLG.EOF) do begin
trvMain.Items.AddChildObject(lRootNode, mDataSecurity.qryBEN_DLGben_name.AsString, TAbteilung.Create(mDataSecurity.qryBEN_DLGben_id.AsFloat, mDataSecurity.qryBEN_DLGben_name.AsString, mDataSecurity.qryBEN_DLGben_mc.AsString));
mDataSecurity.qryBEN_DLG.Next;
end;
lRootNode.Expanded := lWasExpanded;
finally
trvMain.Items.EndUpdate;
end;
end;
Собствено сабж