Delphi XE6 Android下捕获功能键

http://blog.sina.com.cn/s/blog_44fa172f0101rp1q.html

 (2014-05-03 21:43:40)
标签: 

it

分类: DelphiXE6
在Form的Onkeyup事件中,参数Key,为按键值:
vkMenu:菜单键
vkHardwareBack:back键
 
更详细的键定义在System.UITypes单元。
 
procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  var KeyChar: Char; Shift: TShiftState);
begin
  if Key = vkHardwareBack then
  begin
      //这里处理back键的代码
      Key := 0;//处理完后清0.
  end;
  if Key=vkMenu then
  begin
     //处理menu键的代码
     Key:=0;
  end;
end;

2015-12-13补充:
android4.0以后不让用户程序来处理Home键了,具体在这里