TDBGridEh and vertical scrollbar

If you work with different types of dataset you can notice that for some types of dataset the DBGrid shows vertical scrollbar correctly, but for other dataset their vertical scrollbar has only three positions independently of record count in dataset. To adjust the vertical scrollbar accommodation the DBGrid uses RecordCount and RecNo property of DataSet component. But some dataset holds -1 in RecordCount and RecNo. DataSet function IsSequenced indicates whether the underlying database table uses record numbers to indicate the order of records. When IsSequenced returns True value, applications can safely use the RecNo property to navigate through records in the dataset and DBGrid can use RecNo property to show thumb position in vertical scrollbar. But when IsSequenced returns False value, DBGrid can not define current record position and it shows vertical scrollbar in three positions. DBGridEh component has possibility to show proportional scrollbar for no sequenced dataset. To do it we need to activate SumList and create list of record bookmarks. Set SumList.Active to True and SumList.VirtualRecords to True. SumList will run through dataset and create list of records bookmarks. If you use client/sever technology to access database SumList will force dataset to fetch all records, but this operation can take much time. Keep in mind that VirtualRecords will work only for full relationship bookmarks dataset, it means that DataSet.ComapreBookmark function has to return > 0 if record1 is after record2 (i.e. record to which bookmark1 indicates has to be after record to which bookmark2 indicates). It must return 0 if bookmark1 and bookmark2 points to the same record, and value < 0 if record1 is before record2. TBDEDataSet in most cases support full relationship bookmarks.

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