Subject Re: [IBO] How to position selected record in grid to center????
Author Geoff Worboys
> I tried your code, and thought it worked at first, but then I
> noticed that it alternated between centering the row and placing it
> about 2 lines down from the top. Center Top Center Top Center Top
> ...

Yep I do see that in a sorted grid (my original test had no sorting).

First - do use an "if Locate(..." so that you are only trying to
adjust things if locate found the record.

Second - my original code seems to have been mistaken in its use of
GridRow. This seems to work...

if qyAltGrid.Locate('ALT_PART', Part,
[lopPartialKey, lopFindNearest]) then
gridAlt.TopRowNum := qyAltGrid.RowNum -
(gridAlt.VisibleGridRows div 2 );

You may need to adjust slightly according to whether the title (fixed)
row is showing - which is what I thought was happening by using
GridRow. I am not entirely clear why the first code was not
consistent but if at first you dont succeed...


> Any ideals???

Lots of very high ideals :-)

--
Geoff Worboys
Telesis Computing