CheckEvents
Previous  Top  Next

:CheckEvents - Callback Slot for external EventLoop routine.

Callback Slot

:CheckEvents := {|| ... } --> lCancel  

Parameters

None  

Expected Return Value

lCancel  
lCancel should be either .T. (TRUE), if the current process should be stopped or .F. (FALSE), if the current process should be continued.  

Description

During time-consuming operations, the protected method :EventLoop() is called after each Item has been processed. Those operations include:  
 
·Adding/Updating of Multiple Files/Entries to the Zip File with the :AddDir() method.  
·Extracting of Multiple Files/Entries from the Zip File with the :ExtractAll() method.  
·Testing of Multiple Files/Entries of the Zip File with the :Test() method.  
·Searching for Orphaned Files/Entries in the Zip File with the :Test() method.  
·Correcting of Multiple Files/Entries in the Zip File with the :Fix() method.  
 
The :EventLoop() method will by default process all pending events, and will then check if either the ESC Key was pressed or an xbeP_Close event was created. In either of those cases, the program will return .T. (TRUE) to cancel the current process. Otherwise it will return .F. (FALSE) to continue with the next entry/item.  
 
If the :CheckEvents Callback Slot contains a CodeBlock instead of NIL, this CodeBlock is instead executed. The specified CodeBlock may or may not process pending events and may or may not allow the user to cancel the process. The expected Return Value of this CodeBlock must be logical, and determines if the process should be cancelled. Invalid (or missing) return values will default to .F. (FALSE), and the process continues.  
 
Any changes to this CallBack instance variable take immediately effect its value is not persistent and is not saved with a Zip File! The :Close() and :New() methods will reset the value to NIL.  

Examples

·Standard behavior -- Process all Events, return .T. if either the ESC Key was pressed or an xbeP_Close event was created, otherwise return .F.:  
 
oZip:CheckEvents := NIL  
 
·Always Continue -- No Events are processed and the process can not be interrupted:  
 
oZip:CheckEvents := {|| .f.}  
 
·Call a Function named "MyEventLoop()" which should process (or ignore) all events, and return either .T. (to cancel the process) or .F. (to continue):  
 
oZip:CheckEvents := {|| MyEventLoop()}