Hi!
Just curious, did you set ESCAPE OFF? If it is ON, I guess it is the problem. If OFF... I guess it is because form handled key pressings separately if control did not handle them in grid. NODEFAULT should prevent this behavior, however, I'm not wondered because there are a lot of otehr problems in controls inside grid - bet you found one more ;)
Try to put KeyPress code in the form KeyPress event and set form's property KeyPreview to .T.
Another solution - try to use ON KEY LABEL definition or ON ESCAPE.
HTH.
>Hi,
>I found a strange problem with a textbox class that I'm using in a grid. Here's some code from the KeyPress event:
>
>*-- textbox.KeyPress
>LPARAMETERS nKeyCode, nShiftAltCtrl
>
>
>DO CASE
> CASE nKeyCode = -1
> This.ilEditMode = .t.
> CASE nKeyCode=27
> IF This.ilEditMode
> *-- if we're in edit mode, reset mode and
> *-- suppress the ESC key
> *-- Note: this code doesn't work if the textbox is in grid!
> ThisForm.ilEditMode = .f.
> NODEFAULT
> ENDIF
> *-- etc...
>ENDCASE
>
>The idea is to suppress the ESCAPE key if we're in edit mode. NODEFAULT doesn't prevent the form from being closed. The same textbox works perfectly if it's outside of the grid. Is this a known bug or am I missing something?
>
>Any ideas are appreciated.
Vlad Grynchyshyn, Project Manager, MCP
vgryn@yahoo.comICQ #10709245
The professional level of programmer could be determined by level of stupidity of his/her bugs
It is not appropriate to say that question is "foolish". There could be only foolish answers. Everybody passed period of time when knows nothing about something.