ibbm


In the past (fox 2.5) I use to use the "on key label esc thisform.cancelscreen " to allow users to cancel there entries and return to the original screen. I have a main screen that calls an order screen. In the load of the order screen i have this line of code. I have a method in the order form called cancelscreen but when I hit escape I get the message that This form can only be called through a method. Can someone suggest how I can do this.

Thanks in advance.




Re: using on key label esc....

dni


You may need to put code in KeyPress method and at form properties to put KeyPreview = .T.







Re: using on key label esc....

ibbm

That did the trick! Thank you so much!






Re: using on key label esc....

ibbm

This worked on one screen but it doesn't work on the next

The keypress works with a space bar but only the first time it's on the screen. It doesn't do anything with the escape key Any ideas





Re: using on key label esc....

dni

You may need to have set escape off and use in keypress method

lastkey() = 27....or use a another key...






Re: using on key label esc....

dni

PS. Next time please don't mark the answer and then unmark it, just leave it unmark in my case...!






Re: using on key label esc....

ibbm

sorry, about the unmark it worked like a dream until I got to the next screen a little bit later. I thought that if I left it marked I wouldn't get the additional question answered. It did do the trick for one of my screens so it was the answer. should I have just started a new thread I so appreciate having this forum I certainly wouldn't want to cause trouble for it.





Re: using on key label esc....

Tamar E. Granor

A general solution to this problem is to have a Cancel button on the form and set its Cancel property to .T. Then pressing ESC is the same as clicking that button.

Tamar