trap down arrow 
Author Message
 trap down arrow

I've seen hints on how to make the <ENTER> key function like the TAB
key, that is, to make it move to the next field.  I'm doing an input
screen with 12 months of data.  The users expect to use the DOWN ARROW
key to move to the next field and UP ARROW to go to the previous
field.  Any experts out there that can help?

I've tried:

procedure TInputForm.FormKeyPress(Sender: TObject; var Key: Char);
{Make sure the forms' KeyPreview property
is set to True}
begin
 if (Key = #80) then
   begin
      Key := #0;   { Eat the DOWN ARROW  key }
       Perform(WM_NEXTDLGCTL, 0, 0);
   end;

end;



Mon, 21 Dec 1998 03:00:00 GMT  
 trap down arrow

Quote:

> I've seen hints on how to make the <ENTER> key function like the TAB
> key, that is, to make it move to the next field.  I'm doing an input
> screen with 12 months of data.  The users expect to use the DOWN ARROW
> key to move to the next field and UP ARROW to go to the previous
> field.  Any experts out there that can help?

> I've tried:

> procedure TInputForm.FormKeyPress(Sender: TObject; var Key: Char);
> {Make sure the forms' KeyPreview property
> is set to True}
> begin
>  if (Key = #80) then
>    begin
>       Key := #0;   { Eat the DOWN ARROW  key }
>        Perform(WM_NEXTDLGCTL, 0, 0);
>    end;

> end;

The KeyPress event does not recognize arrow keys and such. Use
the KeyDown event. If I were you, I would derive a component from
TDBEdit and raise custom events like OnUpKey and OnDownKey that I could
attach some code to.

Good Luck,
Peter



Wed, 23 Dec 1998 03:00:00 GMT  
 trap down arrow

Quote:

> I've seen hints on how to make the <ENTER> key function like the TAB
> key, that is, to make it move to the next field.  I'm doing an input
> screen with 12 months of data.  The users expect to use the DOWN ARROW
> key to move to the next field and UP ARROW to go to the previous
> field.  Any experts out there that can help?

> I've tried:

> procedure TInputForm.FormKeyPress(Sender: TObject; var Key: Char);
> {Make sure the forms' KeyPreview property
> is set to True}
> begin
>  if (Key = #80) then
>    begin
>       Key := #0;   { Eat the DOWN ARROW  key }
>        Perform(WM_NEXTDLGCTL, 0, 0);
>    end;

> end;

The KeyPress event does not recognize arrow keys and such. Use
the KeyDown event. If I were you, I would derive a component from
TDBEdit and raise custom events like OnUpKey and OnDownKey that I could
attach some code to.

Good Luck,
Peter



Wed, 23 Dec 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. DBGrid: want to use <Enter> in lieu of <down arrow>

2. Printing Forms in Delphi, arrows on Combo Boxes

3. Arrow keys

4. Need help with mouse arrow.

5. Move sprite with arrow keys.

6. arrow keys.

7. Arrow Key

8. mouse arrow pointer in textmode ???

9. Help me on my MS Quick Pascal (Arrow keys)

10. arrows keys

11. about keyboard arrows and functions keys

12. How to read arrow keys from the keyboard?

 

 
Powered by phpBB® Forum Software