* Valid event code local oObject oObject = sys(1270) if lastkey = 27 or (type('oObject') = 'O' and ; type('oObject.lCancel') = 'L' and oObject.lCancel) return .t. endif return this.Validation()Note that commandbutton class has the custom property lCancel which determines is this button is used as Cancel button, and other classes have custom validation method which performs the validation itself.
* Valid event code
local oObject
oObject = sys(1270)
if lastkey = 27 or oObject.name = "MyCancelButton"
return .t.
endif
* validation code here
HTH,
NickNick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro
"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison