Subject Re: USE of ENTER KEY
From Mervyn Bick <invalid@invalid.invalid>
Date Thu, 23 Feb 2017 10:41:57 +0200
Newsgroups dbase.getting-started

On 2017-02-22 5:44 PM, Akshat Kapoor wrote:
> Mustansir Ghor Wrote:
>
>> Hello Everyone
>>
>> In a grid which event will be fired on pressing the "ENTER" key
>>
>> Regards
>> Mustansir
>
> I have trapped the enter key using the onkeylabel. Various steps involved are as follows
> In the start of the form
> ........

ON KEY LABEL has its uses and seems to be mostly used for setting the
Function keys.  Depending on what Mustansir wants to do it may not be
suitable here.

Normally pressing Enter (or Tab) when a grid has focus moves the cursor
to the next field.  Setting ON KEY LABEL ENTER CLASSNAME::WHATEVER() to
execute code "swallows" the enter before it executes the code.  This
means that although the code is executed the cursor doesn't move in the
grid.  If this is what Mustansir needs then he can use ON KEY LABEL.

If Mustansir wants pressing the Enter key to trigger code AND move the
cursor there's a problem.  If he adds KEYBOARD "{enter}" to the code to
replace the "swallowed" Enter he'll wind up with an infinite loop.

In theory it should work if the ON KEY LABEL is disabled before
keyboarding Enter and then resetting ON KEY LABEL afterward.  In
practice this doesn't work as dBASE still enters an infinite loop. :-(

Mervyn.