Permalink
Browse files

Fix crash in checklist cell editor, eg used for column selection in f…

…oreign key list. Closes #473.
  • Loading branch information...
ansgarbecker committed Jan 13, 2019
1 parent 8d27e1d commit fe3660b2745c46334b828aaf714340ca3fe2b693
Showing with 25 additions and 2 deletions.
  1. +25 −2 source/grideditlinks.pas
@@ -118,6 +118,9 @@ TSetEditorLink = class(TBaseGridEditorLink)
FPanel: TPanel;
FCheckList: TCheckListBox;
FBtnOK, FBtnCancel: TButton;
FEndTimer: TTimer;
procedure BtnOkClick(Sender: TObject);
procedure BtnCancelClick(Sender: TObject);
public
ValueList: TStringList;
constructor Create(Tree: TVirtualStringTree); override;
@@ -947,12 +950,16 @@ constructor TSetEditorLink.Create(Tree: TVirtualStringTree);
FBtnOk := TButton.Create(FPanel);
FBtnOk.Parent := FPanel;
FBtnOk.Caption := _('OK');
FBtnOk.OnClick := DoEndEdit;
FBtnOk.OnClick := BtnOkClick;

FBtnCancel := TButton.Create(FPanel);
FBtnCancel.Parent := FPanel;
FBtnCancel.Caption := _('Cancel');
FBtnCancel.OnClick := DoCancelEdit;
FBtnCancel.OnClick := BtnCancelClick;

FEndTimer := TTimer.Create(FPanel);
FEndTimer.Interval := 50;
FEndTimer.Enabled := False;
end;


@@ -1037,6 +1044,22 @@ procedure TSetEditorLink.SetBounds(R: TRect); stdcall;
end;


procedure TSetEditorLink.BtnOkClick(Sender: TObject);
begin
// Timer based click on OK button, to prevent crash when theming is active
FEndTimer.OnTimer := DoEndEdit;
FEndTimer.Enabled := True;
end;


procedure TSetEditorLink.BtnCancelClick(Sender: TObject);
begin
// Timer based click on Cancel button, to prevent crash when theming is active
FEndTimer.OnTimer := DoCancelEdit;
FEndTimer.Enabled := True;
end;



{ TInplaceEditorLink }

0 comments on commit fe3660b

Please sign in to comment.