Solved

Using Enter Key to switch columns in DBGrid

Posted on 1998-12-03
2
248 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 50 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi - replicating a form 8 73
Printing problem 2 91
QRReport  TQrmemo vertical stretching 1 45
Graphics32 under Delphi 10.1 Berlin 2 62
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

785 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