Solved

Using Enter/Return insteat of Tabs

Posted on 2000-04-23
3
136 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
Comment Utility
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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now