Function DbRegisterClient() Foundation
Registers an object to receive messages from a work area.
DbRegisterClient( <object> ) --> lSuccess
The return value of DbRegisterClient() is .T. (true) when the object could be registered in the current work area, otherwise it is .F. (false).
The function DbRegisterClient() synchronizes a database engine (DBE) and an object. When a file is opened via USE or DbUseArea(), a database object (DBO) is created based on the current DBE. The DBO manages the files in the work area, and represents the work area.
In a GUI application, Xbase Parts are used to represent the data stored in a file (field variables). A dialog window is generally used along with XbpSLE objects to display data from a work area on the screen. Using DbRegisterClient(), the objects that display data from a work area are registered with the work area (to be precise: with the database object which manages the work area).
Only objects that support the :notify() method can be registered. A database object calls the :notify() method of all registered objects before and after performing database operations.
When an object is registered in a work area (DBO), it automatically receives messages about database operations performed in the work area. Such messages are especially significant in programming GUI applications where multiple windows can simultaneously display or manage data from a single database. When a database operation occurs in a work area, the xbeDBO_Notify event is generated and all registered objects are sequentially notified. The objects must support the method :notify().
When the function AppEvent() returns the event code xbeDBO_Notify, a numeric value identifying a database operation is in the first message parametermp1. Constants are defined in the DMLB.CH file for the possible values. These are listed in the following table:
Constant | Description |
---|---|
DBO_CLOSE_REQUEST | File in work area will be closed |
DBO_BULK_REQUEST | Time consuming database operation begins |
DBO_BULK_COMPLETE | Time consuming database operation ends |
DBO_CHANGE_ORDER | Order of records changed (logical or physical order) |
DBO_TABLE_UPDATE | Data in current record modified |
DBO_TABLE_DELETED | Record deleted |
DBO_TABLE_APPEND | New record created |
DBO_MOVE_PROLOG | Record pointer will be moved |
DBO_MOVE_DONE | Movement of record pointer ends |
DBO_GOTOP | Record pointer set to beginning of file |
DBO_GOBOTTOM | Record pointer set to the end of file |
When one of the database operations listed in this table is performed in the work area, the DBO calls the :notify() method of all registered objects and passes the appropriate message to it.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.