Exit
Exit() Event
Called when the form is terminated
Applies to: Form , TabbedItem
This event is called when the form is terminated, i.e. when the Cancel or OK buttons are clicked or if the Terminate() form method is executed. KCML has already destroyed the form at the point this event is triggered. This event handler can be used to clean up any resources the prgram has associated with the form.
You cannot reference any controls, in particular any OCX controls, that were on the form as they will have been terminated before this event is raised.
Furthermore you must not open any new forms in the exit event handler as the client will not have a parent for them. This was permitted in KCMLs prior to KCML 6.00, and often worked, but will now give a P34 error.
If you wish to catch any attempt by the user to terminate a form prematurely then you need to have a Click() handler for a properly designated Cancel button. The click event can be discarded by returning FALSE from this event handler. The standard Windows close mechanisms of the X button in the top right of the title bar, the system menu button on the left of the title bar and the ALT-F4 key will trigger the Click() event for the Cancel button and will have no effect if there is no Cancel button.
Tab
The Tab control Exit() event is called each time the specific tab is deactivated because the user selects another tab page on the same control. This event is useful for verifying the users input is valid before allowing another tab to be selected. To prevent the user from leaving the current tab this event should return FALSE. Tab control event handlers are created for each tab using the Tab Control editor within the Forms designer.
This event is not triggered if focus goes to another control. It is only relevant if the active tab on the control is changed.
There is also a Enter() event that can be triggered for the new tab when it is activated.