Solved

Using Enter/Return insteat of Tabs

Posted on 2000-04-23
3
140 Views
Last Modified: 2010-04-04
Developing in Delphi5 I need to default the total system to accept Enter/Return instead of Tab.
Is there a global instruction I can give the Project to default to this setting, and if so, what is it.

Thanks

Ben

0
Comment
Question by:BenPols
3 Comments
 

Expert Comment

by:Gurkan
ID: 2742950
Hi,
Just go to www.undu.com and download the free component (with source) doing that.
0
 
LVL 3

Accepted Solution

by:
f15iaf earned 50 total points
ID: 2742988
set  form1.keypreview to "true"
and set property "tabstop" in all controls to "false";

and write this code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  i:integer;
implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);{oncreate}
begin
        i:=0;
end;

procedure TForm1.FormKeyPress(Sender: TObject; var Key: Char);{onkeypress}
begin
        if(key=chr(13))then
        begin
                if(i=form1.ControlCount-1)then
                i:=0
                else
                i:=i+1;
                form1.activecontrol:=Twincontrol(form1.controls[i]);

        end;

end;

end.
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 2743090
hi benpols,

assign all OnKeypress-events of the controls,
where you want to perform this, to this procedure:

procedure TForm1.EditKeyPress(Sender: TObject; var Key: Char);
begin
  if (key = #13)  then
  begin
    PostMessage(Self.Handle,WM_NEXTDLGCTL,0,0);
    key := #0;
  end;
end;

meikl
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

830 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