Paul,
Thanks for replying.
The problem is definitely the grid. The controls are added to the grid programmatically (RemoveObject() AddObject()). So there's only one control in each column.
I got two suggestions from Vlad. The first one was to catch the ESC key in the form's keyPress() and do a NODEFAULT. This requires KeyPreview to be set to .t.
The second suggestion was to set a flag in the control's keyPress and check this flag in the grid's valid() and RETURN(0) if the flag is set. This prevents the grid from losing focus. I thought this to be the better solution (that's way I gave it 3 stars). However, after some more testing I discovered that pressing ESC in the grid's control caused the entered text to be lost (because NODEFAULT had no effect). Therefore I used the first suggestion which does exactly what I want. The only downside is that it is less encapsulated.
>Hi Daniel,
>Is it possible that your grid is intercepting your keypress event? Also, do you have more than one control dropped in that column... if so is the proper one listed in the columns currentControl property?
>
>These are just a few things that came to mind I would check. Hope it helps lead you to success!!
>
>Paul A. Busbey
>I.S. Department
>Sparagowski & Associates
Daniel