Hi, weiss nicht ob dir das was hilft bei deinem Vorhanben!
Das habe ich in der Delphi 6 Hilfe gefunden,
A KeyDown method is a protected method for a control’s OnKeyDown event. The control itself calls KeyDown in response to a Windows key-down message. When overriding the inherited KeyDown method, you can include code that provides other responses in addition to calling the OnKeyDown event.
To override KeyDown, follow these steps:
1 Add a KeyDown method to the TDBCalendar class:
[/delphi]
type
TDBCalendar = class(TSampleCalendar);
...
protected
procedure KeyDown(var Key: Word; Shift: TShiftState; X: Integer; Y: Integer);
override;
...
end;
[/delphi]
2 Implement the KeyDown method:
Delphi-Quellcode:
procedure KeyDown(var Key: Word; Shift: TShiftState);
var
MyKeyDown: TKeyEvent;
begin
if not ReadOnly and (Key in [VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT, VK_END,
VK_HOME, VK_PRIOR, VK_NEXT]) and FDataLink.Edit then
inherited KeyDown(Key, Shift)
else
begin
MyKeyDown := OnKeyDown;
if Assigned(MyKeyDown) then MyKeyDown(Self, Key, Shift);
end;
end;
When KeyDown responds to a mouse-down message, the inherited KeyDown method is called only if the control’s ReadOnly property is False, the key pressed is one of the cursor control keys, and the datalink object is in edit mode, which means the field can be edited. If the field cannot be edited or some other key is pressed, the code the programmer put in the OnKeyDown event handler, if one exists, is executed.
Damit kann man den die keydown methode verallgemeinert!
@wardz