?
Solved

Using Enter Key to switch columns in DBGrid

Posted on 1998-12-03
2
Medium Priority
?
280 Views
Last Modified: 2012-05-04
How can I use the <Enter> key to switch
to next columns inside DBGrid?
0
Comment
Question by:davichoi
2 Comments
 
LVL 8

Accepted Solution

by:
ZifNab earned 200 total points
ID: 1349174
hi davichoi,

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Db, DBTables, Grids, DBGrids;

type
  TForm1 = class(TForm)
    DBGrid1: TDBGrid;
    Table1: TTable;
    DataSource1: TDataSource;
    procedure DBGrid1KeyDown(Sender: TObject; var Key: Word;
      Shift: TShiftState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.DBGrid1KeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key = 13 then key := 9;
end;

end.

Regards, Zif.
0
 

Author Comment

by:davichoi
ID: 1349175
Thanks for you answer. But I use the <Tab> to switch to the other controls, so I have desabled the <Tab> key in the
DBGrid->Options.

I used the following codes to let <Enter> key to act like <Tab> key with ordenary controls to switch to each other in the KeyDown Event:

If Key = vk_Return Then
      PostMessage(Handle, WM_NEXTDLGCTL, 0, 0);

It worked very well. In case do you know how to do the samething with Windows API to achieve the same funcionality?

Thanks.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Integration Management Part 2
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question