SynCompletion: Fix gtk2 only: panel steals KeyDown(key-down/press events from form) issue #17769

git-svn-id: trunk@28010 -
This commit is contained in:
martin 2010-10-31 13:59:43 +00:00
parent b9309ce87a
commit 98001cb19e

View File

@ -105,6 +105,8 @@ type
{ TSynBaseCompletionForm }
TSynBaseCompletionForm = class(TForm)
procedure SDKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure SDKeyPress(Sender: TObject; var Key: char);
protected
FCurrentString: string;
FOnKeyPress: TKeyPressEvent;
@ -475,6 +477,7 @@ begin
FResizeLock := 1; // prevent DoResize (on Handle Creation) do reset LinesInWindow
FHintLock := 0;
BeginFormUpdate;
KeyPreview:= True;
inherited Create(AOwner);
FItemList := TStringList.Create;
BorderStyle := bsNone;
@ -508,6 +511,9 @@ begin
SizeDrag.Height := Max(5, abs(Font.Height) * 2 div 3);
SizeDrag.Cursor := crSizeNWSE;
SizeDrag.OnKeyPress:=@SDKeyPress;
SizeDrag.OnKeyDown:=@SDKeyDown;
Scroll.Anchors:=[akTop,akRight, akBottom];
Scroll.AnchorSide[akTop].Side := asrTop;
Scroll.AnchorSide[akTop].Control := self;
@ -850,6 +856,17 @@ begin
Position := Position - 1;
end;
procedure TSynBaseCompletionForm.SDKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
KeyDown(key,shift);
end;
procedure TSynBaseCompletionForm.SDKeyPress(Sender: TObject; var Key: char);
begin
KeyPress(key);
end;
procedure TSynBaseCompletionForm.UTF8KeyPress(var UTF8Key: TUTF8Char);
begin
debugln('TSynBaseCompletionForm.UTF8KeyPress A UTF8Key="',DbgStr(UTF8Key),'" ',dbgsName(TObject(TMethod(OnUTF8KeyPress).Data)));