Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bookmark #79

Open
Shaman2 opened this issue Mar 20, 2024 · 3 comments
Open

Bookmark #79

Shaman2 opened this issue Mar 20, 2024 · 3 comments
Assignees
Labels

Comments

@Shaman2
Copy link

Shaman2 commented Mar 20, 2024

Нижеследующий код приводит к сбоям если использую компонент дерева с большой вложенностью.

 var ABookmark: TBookMark;
  FDBTreeView.FDataLink.DataSet.DisableControls;
  try
    ABookmark := FDBTreeView.FDataLink.DataSet.GetBookmark;
    try
      ANode.HasChildren := FDBTreeView.LockedLocate(FDBTreeView.FParentFieldName, Result.FKeyFieldValue, []);
      FDBTreeView.FDataLink.DataSet.GotoBookmark(ABookmark);
    finally
      FDBTreeView.FDataLink.DataSet.FreeBookmark(ABookmark);
    end;
  finally
    FDBTreeView.FDataLink.DataSet.EnableControls;
  end;

Проблема именно в работе с букмарками, так как переписав код вот так все работает на ура

  var ID: Integer;
  FDBTreeView.FDataLink.DataSet.DisableControls;
  try
    ID := FDBTreeView.FDataLink.DataSet.Fields[0].AsInteger;
    try
      ANode.HasChildren := FDBTreeView.LockedLocate(FDBTreeView.FParentFieldName, Result.FKeyFieldValue, []);
      FDBTreeView.FDataLink.DataSet.Locate(FDBTreeView.FDataLink.DataSet.Fields[0].FieldName,ID,[]);
    finally
    end;
  finally
    FDBTreeView.FDataLink.DataSet.EnableControls;
  end;
@Shaman2
Copy link
Author

Shaman2 commented Mar 20, 2024

Ну и на всякий случай:

function LockedLocate(const AFieldName: string; AValue: Variant; AOptions: TLocateOptions): Boolean;
begin
BeginUpdate;
try
Result := FDataLink.DataSet.Locate(AFieldName, AValue, AOptions)
finally
EndUpdate;
end;
end;

@madorin
Copy link
Owner

madorin commented Mar 31, 2024

@Shaman2 что за сбои получаете? какой call stack?

@madorin madorin self-assigned this Mar 31, 2024
@Shaman2
Copy link
Author

Shaman2 commented Apr 1, 2024

@Shaman2 что за сбои получаете? какой call stack?

В данном случае идет обход дерева, просто при этой процедуре при большой вложенности получаю не те данные и идет позиционирование дерева на другой ветке дерева

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants