EhLib
ContentsIndexHome
PreviousUpNext
Brief description of TDBGridEh, TDataLink and TDataSet

All below texts are equally pertained in both TDBGridEh component and TDBGrid component. 

A TDBGridEh control lets you to view and to edit records in a dataset as a tabular grid format.

TDBGridEh does not store data in itself, it only show data from dataset via TDataLink object. Every database control have internal TDataLink object to interact with dataset. You can connect TDBGridEh to dataset using DataSource property. If you already have used TStringGrid component you can see that data shows in TStringGrid and in TDBGridEh very similarly, but mechanism that uses to show data in TStringGrid and in TDBGridEh are very different. In TStringGrid count of rows is equal to rows in array of strings, while in TDBGridEh (and TDBGrid) count of rows always not more than count of visible rows and although vertical scrollbar can display thumb position regarding the count of record in dataset, In reality, it take information not from grid but directly from dataset. TDataSet doesn't allow us to work with data as with array of data i.e. we cannot quickly get value of the field from certain record. Some types of datasets have not even such notion as record number (in such datasets we can only know what we are at the beginning of dataset or at the end of it or somewhere between them. In that case DBGrid shows vertical scrollbar only in three positions). But to have possibility to draw several records simultaneously, TDataLink object allows having buffer of records (record buffer window) for quick random access. DBGrid uses this possibility of datalink and it sets size of record buffer window equal to count of visible rows in the grid. We cannot control what record must be first in this buffer, DataLink itself scrolls record buffer window when we navigate through the dataset. And it controls the scrolling of record buffer window so that the active record is always in the record buffer window. It is a reason why the active record changes position when users change thumb position of vertical scrollbar using mouse.

Copyright (c) 1998-2013. All rights reserved.
What do you think about this topic? Send feedback!