Solved

Using Enter/Return insteat of Tabs

Posted on 2000-04-23
3
138 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

895 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

18 Experts available now in Live!

Get 1:1 Help Now