Arbortext Command Language > Callbacks > doc_add_callback > delete_region Callback Type
  
delete_region Callback Type
Function prototype:
function funcname (doc, buffername, startoid, startpos, endoid, endpos, flags, op)
delete_region is called before an attempt to delete a contiguous region of a document in an edit window. This callback can be used in place of the delete, pending_delete, and cut callbacks.
Arguments:
doc — The identifier of the document in which the delete was attempted.
buffername — The name of the paste buffer that is the target if the delete is a cut operation. The standard paste buffer is named default. If the delete is not a cut, then buffername will be an empty string.
startoid — The object identifier representing the position of the beginning of the region to be deleted.
startpos — The position from startoid (in characters) of the start of the region to be deleted.
endoid — The object identifier representing the position of the end of the region to be deleted.
endpos — The position from endoid (in characters) of the end of the region to be deleted.
flags — The following flags can be set:
0x01 — The selected region is the one to be deleted.
0x02 — The table selection is to be deleted.
0x04 — The delete is a pending delete of an insert operation.
0x08 — The delete is not cancellable from the hook. (The return code from the callback will be ignored.) When set, the callback should be considered informational only and the callback should not attempt the delete itself.
op — The function callback operation. It is generally called twice in succession
1. First call: op == 1. Tests to verify the operation can be attempted. Return arguments are:
0 — Proceed to the Execute step.
-1 — Ignore callback. The code should continue as before.
2. Second call: (occurs unless the process was stopped in the first step) op == 2. Instructs to continue and process the request. Return arguments are:
0 — The code should still control processing.
-1 — The code should be skipped (cancels the delete and the insert operation if the delete is a pending delete).
1 — The delete should be skipped, but proceed with the insert operation (only applies for a pending delete).