From 132d78ca3ce5557a69d7f513b9c73fdad685ecba Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 18 Jun 2015 15:04:52 +0100 Subject: bug: OnKeyPress() keycode parameter was 0 for internally consumed keys. Arrow keys, PgUp, PgDn, Home, End, Enter, Tab, Backspace were all consumed internally and prevented the keycode from being set correctly. --- src/gui/fpg_edit.pas | 5 ++--- src/gui/fpg_memo.pas | 13 ++++++------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/gui/fpg_edit.pas b/src/gui/fpg_edit.pas index 6bc3cc7c..1ddce281 100644 --- a/src/gui/fpg_edit.pas +++ b/src/gui/fpg_edit.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -933,8 +933,7 @@ begin end; end; { if } - if not consumed then - inherited HandleKeyPress(keycode, shiftstate, consumed); + inherited HandleKeyPress(keycode, shiftstate, consumed); if hasChanged then DoOnChange; diff --git a/src/gui/fpg_memo.pas b/src/gui/fpg_memo.pas index 7ec6163c..0e5079c1 100644 --- a/src/gui/fpg_memo.pas +++ b/src/gui/fpg_memo.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -1108,8 +1108,7 @@ begin RePaint; end; -procedure TfpgMemo.HandleKeyPress(var keycode: word; - var shiftstate: TShiftState; var consumed: boolean); +procedure TfpgMemo.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); var cx: integer; ls: string; @@ -1347,14 +1346,14 @@ begin end; end; - if Consumed then - RePaint - else - inherited; + inherited HandleKeyPress(keycode, shiftstate, consumed); if hasChanged then if Assigned(FOnChange) then FOnChange(self); + + if Consumed then + RePaint; end; procedure TfpgMemo.HandleLMouseDown(x, y: integer; shiftstate: TShiftState); -- cgit v1.2.3-70-g09d2