RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
TBDECallback.Create Constructor

Creates an instance of TBDECallback and registers the specified callback with the Borland Database Engine (BDE).

Pascal
constructor Create(AOwner: TObject; Handle: hDBICur; CBType: CBType; CBBuf: Pointer; CBBufSize: Integer; CallbackEvent: TBDECallbackEvent; Chain: Boolean);
C++
__fastcall TBDECallback(TObject * AOwner, hDBICur Handle, CBType CBType, void * CBBuf, int CBBufSize, TBDECallbackEvent CallbackEvent, Boolean Chain);

Call Create to register a callback with the BDE. Create a TBDECallback object before calling any BDE function that should use the callback to respond to events. 

When the BDE encounters the type of event indicated by the CBType parameter, the function specified by the CallbackEvent parameter is called. The CallbackEvent function receives a pointer to a callback descriptor. The type of the callback descriptor varies depending on the CBType. The Delphi application must allocate the memory for the callback descriptor. A pointer to this memory is passed in as the CBBuf parameter, and its size is given by the CBBufSize parameter. 

The Chain parameter indicates whether this callback function should replace any other callbacks of this CBType. When Chain is false, the CallbackEvent function replaces any callbacks registered for the CBType. When Chain is true, the CallbackEvent function is called in addition to other registered callbacks. 

The Handle parameter is an optional parameter indicating the database cursor associated with the BDE function that may generate the callback. Provide a Handle to make the callback specific to function calls for that cursor. 

The types of callback descriptors associated with each CBType are given in the following table. For more information, see the BDE documentation. 

CBTypeUsagecallback descriptor

CBType 
Usage 
callback descriptor 
cbGENPROGRESS  
Respond to information about progress during large batch operations. For example, implement a progress bar or cancel button. Return cbrABORT to cancel, cbrCONTINUE to continue.  
CBPROGRESSDesc  
cbRESTRUCTURE  
Instruct BDE on how to proceed with situations encountered during a table restructure.  
Return cbrYES, to proceed with the default handling, cbrNO to proceed without the default behavior, cbrABORT to cancel the restructure.  
cbBATCHRESULT  
Instruct BDE on how to proceed with situations encountered during a batch operation. Return cbrYES, to proceed with the default handling, cbrNO to proceed without the default behavior, cbrABORT to cancel the batch operation.  
RESTCbDesc  
cbTABLECHANGED  
Respond to notifications that a table has changed. The return value is ignored.  
not used  
cbCANCELQRY  
Return cbrABORT to cancel a long running query, or cbrCONTINUE to keep going. The callback is called periodically during the execution of the query.  
not used  
cbINPUTREQ  
Instruct BDE on how to respond when a file (such as a lookup table) is missing. Indicate the chosen behavior in the CBInputDesc and return cbrCONTINUE.  
CBInputDesc  
cbDBASELOGIN  
Enter a password for an encrypted dBASE table and return cbrCONTINUE.  
CBLoginDesc  
cbFIELDRECALC  
Respond to notifications that fields need to be recalculated. The return value is ignored.  
not used  
cbTRACE  
Respond to trace information about the actions taken by the BDE. The return value is ignored.  
TRACEDesc  
cbDBLOGIN  
Log in to a database server. Return cbrCONTINUE.  
not used.  
cbDELAYEDUPD  
Respond to the notification when cached updates fail to write a modified record to the database. Return cbrABORT to cancel all cached updates, cbrSKIP or cbrCONTINUE to discard the failed update and continue posting records, cbrRETRY to try the failed commit again.  
DELAYUPDCbDesc  

Note: The VCL uses many BDE callback functions. Calling Create with Chain set to false may disable the expected behavior of some objects.
 

Copyright(C) 2008 CodeGear(TM). All Rights Reserved.
What do you think about this topic? Send feedback!