Я не знаю, как в FireMonkey захватывать события мыши и клавиатуры на уровне приложения независимо от платформы. Я не думаю, что это было реализовано в Delphi XE 2 Update 2.
Однако по умолчанию формы FireMonkey получают все события MouseDown и KeyDown до того, как это делают элементы управления.
Если вы просто переопределите события MouseDown и KeyDown в своей форме, вы выполните то же самое.
type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
private
{ Private declarations }
public
{ Public declarations }
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Single); override;
procedure KeyDown(var Key: Word; var KeyChar: System.WideChar; Shift: TShiftState); override;
end;
{ TForm1 }
procedure TForm1.KeyDown(var Key: Word; var KeyChar: System.WideChar;
Shift: TShiftState);
begin
// Do what you need to do here
ShowMessage('Key Down');
// Let it pass on to the form and control
inherited;
end;
procedure TForm1.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Single);
begin
// Do what you need to do here
ShowMessage('Mouse Down');
// Let it pass on to the form and control
inherited;
end;
Если хотите, вы можете продолжать работу с MouseMove, MouseUp, MouseWheel, MouseLeave, KeyUp, DragEnter, DragOver, DragDrop и DragLeave.