CANCEL
CANCEL
Does not require any parameters |
---|
This command is not thread-safe, it cannot be used in preemptive code.
Description
The CANCEL command is used in form or object methods (or in a subroutine) to:
- cancel a new or modified record, for which data entry has been initiated using ADD RECORD or MODIFY RECORD.
- cancel a form displayed with the DIALOG command.
- exit a form displaying a selection of records, using DISPLAY SELECTION or MODIFY SELECTION.
- cancel the printing of a form that is about to be printed using the Print form command (see below).
In the context of data entry, CANCEL performs the same action as if the user had pressed the cancel key (Esc).
CANCEL is commonly executed as a result of a menu command being chosen. CANCEL is also commonly used in the object method of a “no action” button.
It is also often used in the optional close box method for the Open window command. If there is a Control-menu box on a window, ACCEPT or CANCEL can be called, in the method to be executed, when the Control-menu box is double-clicked or the Close menu command is chosen.
CANCEL cannot be queued up. Executing two CANCEL commands in a row from within a method in response to an event would have the same effect as executing only one.
Finally, this command can be used in the On Printing Detail form event, when using the Print form command. In this context, the CANCEL command suspends the printing of the form that is about to be printed, then resumes it on the next page. This mechanism can be used to manage form printing when there is a lack of space or if a page break is required.
Note: This operation differs from that of the PAGE BREAK(*) command that cancels ALL the forms waiting to be printed.
Headless mode
The CANCEL command is allowed in headless mode, in the context of offscreen areas created by VP Run offscreen area or WA Run offscreen area.
Example
Refer to the example of the SET PRINT MARKER command.
System variables and sets
When the CANCEL command is executed (form or printing cancelled), the system variable OK is set to 0.