Unbound Mode > When to Use Unbound Mode |
The row-based unbound modes were designed to provide a workable interface between database APIs and the grid. Therefore, if you simply need to display and manipulate two-dimensional array data, the row-based unbound modes can be cumbersome to work with, and either one of the following DataMode settings would be a better choice:
3 - Application, which fires events on a cell-by-cell basis,
4 - Storage, which communicates directly with an XArrayDB object.
Modes 3 and 4 are specifically intended for an array-based data source, whereas the row-based modes 1 and 2 are more generalized and will work well with any data source.
If you are working with a database instead of an array, the choice comes down to efficiency versus ease of implementation. If you are concerned about efficiency, and would like to minimize the number of events that fire, you should consider using DataMode 2 - Unbound Extended. Mode 2 is also recommended when using database APIs that support multiple-row fetches, such as ODBC. You can also use mode 2 to bypass the overhead associated with an external bound control. For example, instead of binding to a Remote Data Control (RDC), you can use the Remote Data Objects (RDO) in unbound mode 2 to populate the grid with data from an rdoResultSet object.
Mode 3 is easier to implement than mode 2, but it can be less efficient because events fire on a per-cell rather than a per-row basis. If speed and efficiency are your primary concerns, mode 2 is preferred over mode 3.
If your application uses an unbound DBGrid, you should consider switching to mode 2, as it is more efficient. However, if you do not want to revise existing UnboundReadData handlers, you can achieve similar performance improvements in mode 1 by implementing the optional UnboundGetRelativeBookmark event, which the grid fires whenever it needs to determine the bookmark of a row given a starting position and an integral offset. Even if you do not implement this event, your existing application will continue to function properly.
If you are familiar with the Fetch and Update callback events of TrueGrid Pro (TRUEGRID.VBX), then mode 3 is recommended, as the style of coding is very similar. In fact, the "classic" events of application mode are so named because they were patterned after the callback mode events of TrueGrid Pro.