I don't know of a way in FireMonkey to capture mouse and keyboard events at the application level in a platform agnostic way. I don't think that has been implemented yet, as of Delphi XE 2 Update 2.
However, by default FireMonkey forms get all of the MouseDown and KeyDown events before the controls do.
If you simply override the MouseDown and KeyDown events on your form, you'll accomplish the same thing.
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
ShowMessage('Key Down');
inherited;
end;
procedure TForm1.MouseDown(Button: TMouseButton; Shift: TShiftState; X,
Y: Single);
begin
ShowMessage('Mouse Down');
inherited;
end;
If you want, you can keep going with MouseMove, MouseUp, MouseWheel, MouseLeave, KeyUp, DragEnter, DragOver, DragDrop, and DragLeave.