Permalink
Browse files

Make column selection dialog more crash safe against clicks between i…

…tems. Closes #534.
  • Loading branch information...
ansgarbecker committed Feb 10, 2019
1 parent 25394f4 commit 0f6b3ff695561a1da46b7f1a6708202ab3708cbe
Showing with 10 additions and 4 deletions.
  1. +10 −4 source/column_selection.pas
@@ -152,13 +152,19 @@ procedure TColumnSelectionForm.chklistColumnsClickCheck(Sender: TObject);
var
i : Integer;
AllSelected, NoneSelected : Boolean;
FocusedItem: String;
FocusedItemIndex: Integer;
begin
// Add or remove clicked item from list
if chklistColumns.ItemIndex > -1 then begin
if chklistColumns.Checked[chklistColumns.ItemIndex] then
FCheckedColumns.Add(chklistColumns.Items[chklistColumns.ItemIndex])
else
FCheckedColumns.Delete(FCheckedColumns.IndexOf(chklistColumns.Items[chklistColumns.ItemIndex]));
FocusedItem := chklistColumns.Items[chklistColumns.ItemIndex];
if chklistColumns.Checked[chklistColumns.ItemIndex] then begin
FCheckedColumns.Add(FocusedItem)
end else begin
FocusedItemIndex := FCheckedColumns.IndexOf(FocusedItem);
if FocusedItemIndex > -1 then
FCheckedColumns.Delete(FocusedItemIndex);
end;
end;

Allselected := True;

0 comments on commit 0f6b3ff

Please sign in to comment.