DBGridEh垂直滚动条经常不工作,各种属性有用没用都试过,还是不行。
上网去查,好象大家都有这个问题,可就是没有结果。
找到了一篇分析的还在理,是说IsSequenced一返回false就不能用了。而设置了过滤条件IsSequenced就会返回false,那不是不让人用了?
找回原说明文档看一下,发现人家说的很明白,只不过这一段没人翻过来,在中文世界就等于没有,大家都在瞎摸。
简单地说就是:当RecNo不可靠时,DBGridEh可用SumList来做指示,所以,只要把SumList中的Active和VirtualRecords设成True,DBGridEh的垂直滚动条就正常了。
TDBGridEh and vertical scrollbar.
If you works with different type of dataset you can notice that for some type of dataset DBGrid show vertical scrollbar validly but for over vertical scrollbar have only three position independently of record count in dataset. To set vertical scrollbar accomodation DBGrid use RecordCount and RecNo property of DataSet component. But some dataset and even same dataset under some condition 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, applications can safely use the RecNo property to navigate to records in the dataset and DBGrid use RecNo property to show thumb position in vertical scrollbar. But when IsSequenced returns False DBGrid can not define current record position and show vertical scrollbar in three positions. DBGridEh component have possibility to show proportional scrollbar for no sequenced dataset. To do it need to activate SumList and create list of record bookmars. Set SumList.Active to True and SumList.VirtualRecords to True. SumList will run through dataset and create list of record bookmarks, if you use client/sever technology to access database SumList will force dataset to fetch all records, so it 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 bookmark1 > bookmark1 (i.e. record to which indicates bookmark1 have to be after record to which indicates bookmark1), = 0 if bookmark1 = bookmark1, < 0 if bookmark1 = bookmark1. TBDEDataSet in most cases support full relationship bookmarks.