https://www.bbsmax.com/A/obzbgPEMJE/
通过Tab跳转cxgrid网格(左右) ,配置如下
cxGrid1DBTableView.OptionsBehavior.FocusCellOnTab:=True;
tab在delphi中用keydown pressdown都捕获不到
用以下的方法,我单独开的程序可以捕获到tab 但是不知道为什么用在我的程序中就无法相应。
private
YouWantToInterceptTab: Boolean;
// YouWantToInterceptTab为true,就会屏蔽掉tab键,就不会切换控件
{ Private declarations }
procedure CMDialogKey(var AMessage: TCMDialogKey); message CM_DIALOGKEY;
procedure TForm3.CMDialogKey(var AMessage: TCMDialogKey);
begin
if AMessage.CharCode = VK_TAB then
begin
ShowMessage('TAB key has been pressed in ' + ActiveControl.Name);
if YouWantToInterceptTab then
begin
ShowMessage('TAB key will be eaten');
AMessage.Result := 1;
end
else inherited;
end else inherited;
end;
所以还是 cxGrid1DBTableView.OptionsBehavior.FocusCellOnTab:=True;这个方法方便快捷