Subject RE: [IBO] How to position selected record in grid to center????
Author Michael L. Horne
Geoff,

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

I don't understand why, but below is the code I am using.

qyAltGrid.AfterScroll := nil;
try
if (qyAltGrid.Active <> True) then
qyAltGrid.Open;
qyAltGrid.Locate('ALT_PART', Part, [lopPartialKey, lopFindNearest]);
gridAlt.TopRowNum := gridAlt.GridRow[qyAltGrid.RowNum] -
(gridAlt.VisibleGridRows div 2 );
finally
qyAltGrid.AfterScroll := qyAltGridAfterScroll;
end;

Any ideals???

Thanks
Michael L. Horne

> -----Original Message-----
> From: Geoff Worboys [mailto:geoff@...]
> Sent: Friday, May 24, 2002 3:16 AM
> To: Michael L. Horne
> Subject: Re: [IBO] How to position selected record in grid to center????
>
>
> > Maybe I don't understand, but there doesn't appear to be
> > a TIB_Grid.TopRow property, there is a TopRowNum, but
> > it doesn't appear to adjust where the selected row is
> > either. Could you give me more details on to use it.
>
> Heres some code that achieved the desired result in one of my demo
> apps...
>
> with EmployeeDQ do
> begin
> if Locate( 'DEPT_NO', 622, [] ) then
> begin
> EmployeeGrid.TopRowNum := EmployeeGrid.GridRow[RowNum] -
> (EmployeeGrid.VisibleGridRows div 2 );
> ShowMessage( 'Found Dept' );
> end;
> end;
>
>
> --
> Geoff Worboys
> Telesis Computing
>
>
>
> __________________________________________________________________
> _________
> IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> without the need for BDE, ODBC or any other layer.
> __________________________________________________________________
> _________
> http://www.ibobjects.com - your IBO community resource for Tech
> Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>