Setting TMyQuery IndexFieldNames>"" changes current record
Posted: Tue 27 Jan 2009 20:06
I'm using c++ builder (rad studio 2009). I'm finding that if I have a TMyQuery Q showing in a TDBGrid with
Q->IndexFieldNames="" and I click a button that programatically sets Q->IndexFieldNames="SomeField" then the current record is not maintained. The new top record becomes the current record but the AfterScroll event is not even triggered despite the change of record.
It only seems to happen if it's the first thing I do when the programme opens and the grid appears. If I scroll the grid before clicking the sort button the record indicator follows the current record to its new position after sorting. Subsequent sorts made on other fields also work as they should.
When sorting is working as it should the current record is often not 'centred' (as happens with the Locate method) after sorting.
Q->IndexFieldNames="" and I click a button that programatically sets Q->IndexFieldNames="SomeField" then the current record is not maintained. The new top record becomes the current record but the AfterScroll event is not even triggered despite the change of record.
It only seems to happen if it's the first thing I do when the programme opens and the grid appears. If I scroll the grid before clicking the sort button the record indicator follows the current record to its new position after sorting. Subsequent sorts made on other fields also work as they should.
When sorting is working as it should the current record is often not 'centred' (as happens with the Locate method) after sorting.