handle tab key in ControlKeyDown in TCustomEdit and TCustomComboBox

git-svn-id: trunk@6933 -
This commit is contained in:
mattias 2005-03-10 09:02:11 +00:00
parent e6ceebe441
commit 57990d6de7
5 changed files with 46 additions and 16 deletions

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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