setOnCancelHandler event calls user-defined handlers (if there are any):
myCP.setOnCancelHandler(function () { //some code })