Board index » delphi » converting enter key press to a tab keypress

converting enter key press to a tab keypress

how can i convert the enter key to a tab key from the onkeydown event of the
form?

 

Re:converting enter key press to a tab keypress


Quote
>   "DEBORAH A PRICE" <PRICE...@erols.com> writes:
>  how can i convert the enter key to a tab key from the onkeydown event of the
>  form?

I do not know if you can convert it, but you can use it as a tab like this:
Set keypreview to true and add this to the form key down event

  if (key = 13)  then begin
    //Om man tryckt enter
    key := 0; //Nollst?ll knappen
    selectnext(activecontrol,getkeystate(vk_shift) and $80 = 0,True); //Och g? till n?sta. Shift-kollen g?r att den hoppar bak?t med shift+Enter
  end;

(Sorry for my swedish comments)

And, we had this type of question before triggering several comments about that this is not standard W95 behaviour.
So keep that in mind.

johan

Re:converting enter key press to a tab keypress


Quote
johan.lindg...@sundsvall.mail.telia.com wrote:

> >   "DEBORAH A PRICE" <PRICE...@erols.com> writes:
> >  how can i convert the enter key to a tab key from the onkeydown event of the
> >  form?

> I do not know if you can convert it, but you can use it as a tab like this:
> Set keypreview to true and add this to the form key down event

>   if (key = 13)  then begin
>     //Om man tryckt enter
>     key := 0; //Nollst?ll knappen
>     selectnext(activecontrol,getkeystate(vk_shift) and $80 = 0,True); //Och g? till n?sta. Shift-kollen g?r att den hoppar bak?t med shift+Enter
>   end;

> (Sorry for my swedish comments)

> And, we had this type of question before triggering several comments about that this is not standard W95 behaviour.
> So keep that in mind.

> johan

U can try the code in the following:

===> OnKeyPress EVENT !!
if (key = 13)  then begin
    key := #0; {Eat the key to avoid beep sound}
    perform(wm_nextdlgctl,0,0); {Win-API to jump to next control}
end;

Other Threads