LocateEx with lxNearest on date field doesn't centre

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

LocateEx with lxNearest on date field doesn't centre

Post by NoComprende » Mon 05 Jul 2010 17:27

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.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 08 Jul 2010 15:11

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.

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Thu 08 Jul 2010 15:52

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).

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 15 Jul 2010 12:25

Thank you for the information. We have reproduced your issue. We will notify you as soon as we have any result.

bork
Devart Team
Posts: 649
Joined: Fri 12 Mar 2010 07:55

Post by bork » Thu 22 Jul 2010 13:48

Hello

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

NoComprende
Posts: 135
Joined: Tue 09 Jan 2007 13:44

Post by NoComprende » Sun 01 Aug 2010 13:00

Thanks bork.

Post Reply