Page 1 of 1

LocateEx with lxNearest on date field doesn't centre

Posted: Mon 05 Jul 2010 17:27
by NoComprende
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.

Posted: Thu 08 Jul 2010 15:11
by bork
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.

Posted: Thu 08 Jul 2010 15:52
by NoComprende
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).

Posted: Thu 15 Jul 2010 12:25
by bork
Thank you for the information. We have reproduced your issue. We will notify you as soon as we have any result.

Posted: Thu 22 Jul 2010 13:48
by bork
Hello

We have reproduced this problem and fixed it. This fix will be included in the next MyDAC build.

Posted: Sun 01 Aug 2010 13:00
by NoComprende
Thanks bork.