Examples/VirtualTreeView: Fix "Advanced" demo crashing when option -CR is active.

git-svn-id: trunk@65096 -
This commit is contained in:
wp 2021-05-09 10:40:41 +00:00
parent 35660b1577
commit 3368c71d4e

View File

@ -250,7 +250,10 @@ begin
if node <> nil then FTree.FocusedNode := node; if node <> nil then FTree.FocusedNode := node;
Key := 0; Key := 0;
if FTree.CanEdit(FTree.FocusedNode, FTree.FocusedColumn) then if FTree.CanEdit(FTree.FocusedNode, FTree.FocusedColumn) then
{$PUSH}
{$OBJECTCHECKS OFF}
TVirtualStringTreeAccess(FTree).DoEdit; TVirtualStringTreeAccess(FTree).DoEdit;
{$POP}
end; end;
VK_UP, VK_UP,
@ -295,14 +298,20 @@ begin
repeat repeat
// Find a column for the current node which can be focused. // Find a column for the current node which can be focused.
while (col > NoColumn) and while (col > NoColumn) and
{$PUSH}
{$OBJECTCHECKS OFF}
not TVirtualStringTreeAccess(FTree).DoFocusChanging(FNode, node, FColumn, col) not TVirtualStringTreeAccess(FTree).DoFocusChanging(FNode, node, FColumn, col)
{$POP}
do do
col := GetNextColumn(col, True); col := GetNextColumn(col, True);
if col > NoColumn then if col > NoColumn then
begin begin
// Set new node and column in one go. // Set new node and column in one go.
{$PUSH}
{$OBJECTCHECKS OFF}
TVirtualStringTreeAccess(FTree).SetFocusedNodeAndColumn(node, col); TVirtualStringTreeAccess(FTree).SetFocusedNodeAndColumn(node, col);
{$POP}
Break; Break;
end; end;
@ -319,11 +328,14 @@ begin
FTree.FocusedColumn := col; FTree.FocusedColumn := col;
end; end;
if FTree.CanEdit(FTree.FocusedNode, FTree.FocusedColumn) then if FTree.CanEdit(FTree.FocusedNode, FTree.FocusedColumn) then
{$PUSH}
{$OBJECTCHECKS OFF}
with TVirtualStringTreeAccess(FTree) do with TVirtualStringTreeAccess(FTree) do
begin begin
EditColumn := FocusedColumn; EditColumn := FocusedColumn;
DoEdit; DoEdit;
end; end;
{$POP}
end; end;
end; end;