Page 1 of 1

TeeGrid and tab

Posted: Wed Nov 02, 2022 6:23 am
by 18692679
How can I prevent the "tab" key to move between cells?

I want to reserve "tab" and "shift+tab" to move the focus between the controls on the form. not within the grid itself.

Thanks.

Re: TeeGrid and tab

Posted: Fri Nov 04, 2022 1:47 pm
by yeray
Hello,

You could try to skip the event as follows:

Code: Select all

type TTeeGridAccess=class(TTeeGrid);

procedure TForm1.FormCreate(Sender: TObject);
begin
  // ...
  TTeeGridAccess(TeeGrid1).OnKeyDown:=GridKeyDown;
end;

procedure TForm1.GridKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  if Key=VK_TAB then
  begin
    Key:=VK_ESCAPE;
  end;
end;