tabbing with other keys

Using dbEdits, I want to have the enter key do the same thing that the tab key does.  I know how to trap the event of enter being pressed, but how do I tell it to do a tab?
danGynnAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

RBertoraCommented:
what you want to do is send your control a tab message :

here I tab the dbgrid, but you can send
tab messages to any visual component

  sendmessage(DBgrid1.handle,wm_keydown,9,0);

Rob ;-)
0
RBertoraCommented:
hmm perhaps thats not what you want:

why don't you use something
like

dbedit1.onkeydown
  if (key = 10) or (key=13) then dbedit2.setfocus..

and so on for each dbedit box

Rob ;-)
0
danGynnAuthor Commented:
That didn't work.  It actually didn't seem to do anything.  Let me give you some more info.  I have a series of DBEdits each contained in their own panel.  I tried the sendmessage procedure with using both the edit handle and the panel handle.  Neither did anything.  Each of the DBEdit's has a tab order of 0 and the panels have the real tab order.  It works correctly if I actually use the tab key, and it executes send message when I hit the enter key, but the cursor does not move.
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

danGynnAuthor Commented:
The reason that I don't want to use setfocus for each edit is that there are a whole mess load of them, and I don't want to have to write an event handle for each of them telling them where their next tab should be to.
0
rwilson032697Commented:
Try this:

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  case Key of
    { move between each field by pressing the Enter Key }
    VK_RETURN : PostMessage(Handle, WM_NEXTDLGCTL, 0, 0);
  end;
end;

Cheers,

Raymond.
0
danGynnAuthor Commented:
rwilson, that did it!  If you submit an answer, I will give you the points.
0
rwilson032697Commented:
Ta!

Cheers,

Raymond.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.