wxForm::OnCancel

void OnCancel(void)

This member may be derived by the application. When the user presses the Cancel button, this is called, allowing the application to take action. By default, OnCancel deletes the form and the panel associated with it, probably the normal desired behaviour.