Solved

Using Enter/Return insteat of Tabs

Posted on 2000-04-23
3
141 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

732 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