summaryrefslogtreecommitdiff
path: root/src/corelib/fpg_widget.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-06-07 11:42:38 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-06-07 11:42:38 +0100
commit3d98617867e647f40ce92f43f67230ad51d9c1ff (patch)
tree84ec74f555101f459c14c96ca0e0075af6ca9bbc /src/corelib/fpg_widget.pas
parent4545eaf7235b03796b939a9a0b1ea24dd0b0a67f (diff)
downloadfpGUI-3d98617867e647f40ce92f43f67230ad51d9c1ff.tar.xz
Introduced a new OnKeyChar event for TfpgWidget
Diffstat (limited to 'src/corelib/fpg_widget.pas')
-rw-r--r--src/corelib/fpg_widget.pas7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index 8d6bcc8f..8fb68a04 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2012 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -50,6 +50,7 @@ type
FOnDragLeave: TNotifyEvent;
FOnEnter: TNotifyEvent;
FOnExit: TNotifyEvent;
+ FOnKeyChar: TfpgKeyCharEvent;
FOnMouseDown: TMouseButtonEvent;
FOnMouseEnter: TNotifyEvent;
FOnMouseExit: TNotifyEvent;
@@ -146,6 +147,7 @@ type
property OnDoubleClick: TMouseButtonEvent read FOnDoubleClick write FOnDoubleClick;
property OnEnter: TNotifyEvent read FOnEnter write FOnEnter;
property OnExit: TNotifyEvent read FOnExit write FOnExit;
+ property OnKeyChar: TfpgKeyCharEvent read FOnKeyChar write FOnKeyChar;
property OnKeyPress: TKeyPressEvent read FOnKeyPress write FOnKeyPress;
property OnMouseDown: TMouseButtonEvent read FOnMouseDown write FOnMouseDown;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
@@ -949,7 +951,8 @@ end;
procedure TfpgWidget.HandleKeyChar(var AText: TfpgChar; var shiftstate: TShiftState; var consumed: boolean);
begin
- // descendants will implement this.
+ if FFocusable and Assigned(OnKeyChar) then
+ OnKeyChar(self, AText, consumed);
end;
procedure TfpgWidget.HandleKeyPress(var keycode: word; var shiftstate: TShiftState;