From 57990d6de71aef5c7a4fbde3e1d8ec0363a4e99d Mon Sep 17 00:00:00 2001 From: mattias Date: Thu, 10 Mar 2005 09:02:11 +0000 Subject: [PATCH] handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox git-svn-id: trunk@6933 - --- lcl/forms.pp | 10 +++++----- lcl/include/application.inc | 21 ++++++++++++--------- lcl/include/customcombobox.inc | 13 +++++++++++-- lcl/include/customedit.inc | 9 +++++++++ lcl/stdctrls.pp | 9 +++++++++ 5 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lcl/forms.pp b/lcl/forms.pp index 98a700cf62..f499c8f0bd 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -1012,11 +1012,11 @@ type procedure DoBeforeMouseMessage(CurMouseControl: TControl); function IsShortcut(var Message: TLMKey): boolean; public - procedure DoEscapeKey(AControl: TWinControl; Shift: TShiftState; - var Key: Word); - procedure DoReturnKey(AControl: TWinControl; Shift: TShiftState; - var Key: Word); - procedure DoTabKey(AControl: TWinControl; Shift: TShiftState; var Key: Word); + procedure DoEscapeKey(AControl: TWinControl; var Key: Word; + Shift: TShiftState); + procedure DoReturnKey(AControl: TWinControl; var Key: Word; + Shift: TShiftState); + procedure DoTabKey(AControl: TWinControl; var Key: Word;Shift: TShiftState); property CaptureExceptions: boolean read FCaptureExceptions write SetCaptureExceptions; property Handle: THandle read FHandle; diff --git a/lcl/include/application.inc b/lcl/include/application.inc index e6f0396eb1..637dec6898 100644 --- a/lcl/include/application.inc +++ b/lcl/include/application.inc @@ -1214,9 +1214,9 @@ begin end; // handle special navigation keys - DoTabKey(AControl, Shift, Key); - DoReturnKey(AControl, Shift, Key); - DoEscapeKey(AControl, Shift, Key); + DoTabKey(AControl, Key, Shift); + DoReturnKey(AControl, Key, Shift); + DoEscapeKey(AControl, Key, Shift); end; end; @@ -1306,8 +1306,8 @@ begin Result := FMainForm.IsShortcut(Message); end; -procedure TApplication.DoEscapeKey(AControl: TWinControl; Shift: TShiftState; - var Key: Word); +procedure TApplication.DoEscapeKey(AControl: TWinControl; var Key: Word; + Shift: TShiftState); var Form: TCustomForm; begin @@ -1326,8 +1326,8 @@ begin end; end; -procedure TApplication.DoReturnKey(AControl: TWinControl; Shift: TShiftState; - var Key: Word); +procedure TApplication.DoReturnKey(AControl: TWinControl; var Key: Word; + Shift: TShiftState); var Form: TCustomForm; begin @@ -1345,8 +1345,8 @@ begin end; end; -procedure TApplication.DoTabKey(AControl: TWinControl; Shift: TShiftState; - var Key: Word); +procedure TApplication.DoTabKey(AControl: TWinControl; var Key: Word; + Shift: TShiftState); begin if (Key=VK_Tab) and ((Shift-[ssShift])=[]) and (anoTabToSelectNext in Navigation) @@ -1464,6 +1464,9 @@ end; { ============================================================================= $Log$ + Revision 1.110 2005/03/10 09:02:11 mattias + handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox + Revision 1.109 2005/03/08 00:28:03 mattias implemented gtk2 AppMinimize diff --git a/lcl/include/customcombobox.inc b/lcl/include/customcombobox.inc index 604727f2e1..dc5fc40e6a 100644 --- a/lcl/include/customcombobox.inc +++ b/lcl/include/customcombobox.inc @@ -414,16 +414,22 @@ begin if not (Key in [VK_UP,VK_DOWN,VK_END,VK_HOME,VK_PRIOR,VK_NEXT,VK_TAB, VK_RETURN]) then begin - Key:=0; + Skip := True; end; end; if Skip then - Key := 0 + Key := VK_UNKNOWN else inherited KeyDown(Key, Shift); end; +procedure TCustomComboBox.ControlKeyDown(var Key: Word; Shift: TShiftState); +begin + if Application<>nil then Application.DoTabKey(Self,Key,Shift); + inherited ControlKeyDown(Key, Shift); +end; + {------------------------------------------------------------------------------ function TCustomComboBox.SelectItem(const AnItem: String): Boolean; @@ -802,6 +808,9 @@ end; { $Log$ + Revision 1.58 2005/03/10 09:02:11 mattias + handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox + Revision 1.57 2005/03/07 18:46:36 mattias fixed unsetting ItemIndex on changing TComboBox.Text diff --git a/lcl/include/customedit.inc b/lcl/include/customedit.inc index 0c301d1ce4..2386afda20 100644 --- a/lcl/include/customedit.inc +++ b/lcl/include/customedit.inc @@ -314,6 +314,12 @@ begin Result:=false; end; +procedure TCustomEdit.ControlKeyDown(var Key: Word; Shift: TShiftState); +begin + if Application<>nil then Application.DoTabKey(Self,Key,Shift); + inherited ControlKeyDown(Key, Shift); +end; + procedure TCustomEdit.KeyUp(var Key: Word; Shift: TShiftState); begin inherited KeyUp(Key, Shift); @@ -369,6 +375,9 @@ end; { ============================================================================= $Log$ + Revision 1.39 2005/03/10 09:02:11 mattias + handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox + Revision 1.38 2005/03/08 10:32:47 mattias BorderStyle for TCustomEdit in win32 intf from Jesus diff --git a/lcl/stdctrls.pp b/lcl/stdctrls.pp index 25522b1a02..5d9aa497e6 100644 --- a/lcl/stdctrls.pp +++ b/lcl/stdctrls.pp @@ -219,6 +219,8 @@ type TMeasureItemEvent = procedure(Control: TWinControl; Index: Integer; var Height: Integer) of object; + { TCustomComboBox } + TCustomComboBox = class(TWinControl) private FAutoDropDown: Boolean; @@ -283,6 +285,7 @@ type procedure SetStyle(Val: TComboBoxStyle); virtual; procedure RealSetText(const AValue: TCaption); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override; + procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override; property DropDownCount: Integer read FDropDownCount write SetDropDownCount default 8; property ItemHeight: Integer read GetItemHeight write SetItemHeight; @@ -550,6 +553,8 @@ type TEditCharCase = (ecNormal, ecUppercase, ecLowerCase); TEchoMode = (emNormal, emNone, emPassword); + { TCustomEdit } + TCustomEdit = class(TWinControl) private FCharCase: TEditCharCase; @@ -582,6 +587,7 @@ type procedure SetSelText(const Val: string); virtual; procedure RealSetText(const Value: TCaption); override; function ChildClassAllowed(ChildClass: TClass): boolean; override; + procedure ControlKeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyUp(var Key: Word; Shift: TShiftState); override; public constructor Create(AOwner: TComponent); override; @@ -1227,6 +1233,9 @@ end. { ============================================================================= $Log$ + Revision 1.198 2005/03/10 09:02:11 mattias + handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox + Revision 1.197 2005/03/08 10:32:47 mattias BorderStyle for TCustomEdit in win32 intf from Jesus