Query->LocateEx("TDateTimeField",TDateTimeValue, TLocateExOptions()<<lxNearest);
finds the nearest matching date but the record it lands on is not centred in the dbgrid.
I'm using 5.90.0.57 for RAD studio 2009.
LocateEx with lxNearest on date field doesn't centre
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
Hello
When you call the LocateEx function there are two variants of behavior:
1. If a required record is displayed in DBGrid then cursor will change position only, but the record will be not centered in DBGrid.
2. If a required record is not displayed in DBGrid then cursor will change position and the record will be centered.
When you call the LocateEx function there are two variants of behavior:
1. If a required record is displayed in DBGrid then cursor will change position only, but the record will be not centered in DBGrid.
2. If a required record is not displayed in DBGrid then cursor will change position and the record will be centered.
-
NoComprende
- Posts: 135
- Joined: Tue 09 Jan 2007 13:44
Hi bork, it works the way you describe for me on string searches but in the date example I posted above the required record is moved to the current grid row when the required record wasn't already showing in the grid.
e.g. if I have a query that contains a single date field with 1 record for every date in 2010, showing in a grid, and the curently selected record is the record with date 1st Jan (row 1 in grid) then
Query->LocateEx("TDateTimeField",TDateTimeValue, TLocateExOptions()<<lxNearest);
with TDateTimeValue set to 1st Aug will move the record with Date = 1st August to the top row of the grid (not centred as it should be).
e.g. if I have a query that contains a single date field with 1 record for every date in 2010, showing in a grid, and the curently selected record is the record with date 1st Jan (row 1 in grid) then
Query->LocateEx("TDateTimeField",TDateTimeValue, TLocateExOptions()<<lxNearest);
with TDateTimeValue set to 1st Aug will move the record with Date = 1st August to the top row of the grid (not centred as it should be).