Skip to content
Permalink
Browse files

Fix crash when drag'n dropping indexed column in table designer. Closes

  • Loading branch information...
ansgarbecker committed May 19, 2019
1 parent 99e095f commit ce29d1b39b39f33919167f297daae5ccb22b793e
Showing with 6 additions and 1 deletion.
  1. +6 −1 source/table_editor.pas
@@ -1826,7 +1826,8 @@ procedure TfrmTableEditor.treeIndexesDragDrop(Sender: TBaseVirtualTree;
end;
if VT.GetNodeLevel(Node) = 1 then begin
ColPos := Node.Index;
if Mode = dmBelow then Inc(ColPos);
if (Mode = dmAbove) and (ColPos > 0) then
Dec(ColPos);
Node := Node.Parent;
end else
ColPos := Node.ChildCount;
@@ -1879,6 +1880,10 @@ procedure TfrmTableEditor.MoveFocusedIndexPart(NewIdx: Cardinal);
if treeIndexes.IsEditing then
treeIndexes.EndEditNode;
TblKey := FKeys[treeIndexes.FocusedNode.Parent.Index];
if (NewIdx >= TblKey.Columns.Count) or (NewIdx < 0) then begin
MessageBeep(MB_ICONEXCLAMATION);
Exit;
end;
TblKey.Columns.Move(treeIndexes.FocusedNode.Index, NewIdx);
TblKey.SubParts.Move(treeIndexes.FocusedNode.Index, NewIdx);
Modification(treeIndexes);

0 comments on commit ce29d1b

Please sign in to comment.
You can’t perform that action at this time.