Board index » delphi » DBGrid: want to use <Enter> in lieu of <down arrow>

DBGrid: want to use <Enter> in lieu of <down arrow>

Greetings all,

I would very much appreciate some assistance in
translating keystrokes within DBGrid.

I want to enter a series of numbers in a DBGrid column
and would like to type the number from the numeric
keypad and press <enter> rather than <down arrow>
to go to the next row (same column).

I tried the following code under the DBGrid's
OnKeyPress event handler:

Procedure TForm1.DBGrid1KeyPress(Sender: TObject;
  var Key: char);
begin
  if (Key=#13) and
     (DBGrid1.SelectedField=Table1Quantity) then begin
    Key:=char(VK_DOWN);
  end;
end;

This does not work!  Only beeps.

I am aware of using Perform(wm_NextDlgCtl,0,0) to
translate <enter> to <tab> but this doesn't
help me with the grid problem just described.

Many thanks to anyone that can help!

Mark

 

Re:DBGrid: want to use <Enter> in lieu of <down arrow>


I would very much appreciate some assistance in
translating keystrokes within DBGrid.

I want to enter a series of numbers in a DBGrid column
and would like to type the number from the numeric
keypad and press <enter> rather than <down arrow>
to go to the next row (same column).

I tried the following code under the DBGrid's
OnKeyPress event handler:

Procedure TForm1.DBGrid1KeyPress(Sender: TObject;
  var Key: char);
begin
  if (Key=#13) and
     (DBGrid1.SelectedField=Table1Quantity) then begin
    Key:=char(VK_DOWN);
  end;
end;

This does not work!  Only beeps.

I am aware of using Perform(wm_NextDlgCtl,0,0) to
translate <enter> to <tab> but this doesn't
help me with the grid problem just described.

Many thanks to anyone that can help!

Mark

Other Threads