Gustavo,
It sounds like your keypress method is causing an object reference to one of the contained controls like:
thisform.oCurrentC\Textbox = thisform.txtAField
You must
.null. out this reference in order for your form to close. There is a tool, ObjRef, over on my website that helps track these kinds of problems.
It can also happen because of a bug in PEMSTATUS() if you are using it twice in the same if. The solution is to split the calls to different executable lines of code.
>I have some forms based on a form class that I have created. The property KEYPREVIEW is set to .T., and the class intercept some keypresses.
>But the form don't close when I press CTRL + F4 key or don't change to other aplications form with CTRL + F6 key.
>It seems to be very strange because I have other form classes that have keypreview set to .T., and don't have any problems.
>The form closes normaly when I press the 'X' control in right upper corner.