>>Hello Everybody.
>>
>>I've got a grid class right. Well sometimes the grid has only less rows than visible rows in the grid. My form remembers the last record and order before it was closed last. So if I goto the 2nd record of a grid in the init of an custom object, the grid starts on reord two with the third below it and the first above it off the screen and you need to move up to see it.
>>
>>So I want it if there are less rows than total visble rows (filled and blank ones) we just see all of the rows keeping the second or what ever as active.
>>
>>I thought the I could determine the visible rows by dividing the total hieght minus the header hieght by the row height, than determing if there are less filled rows than visble rows then move the grid up. If this is the best method how do I move the grid up but keep the active row the same?
>
>Something like:
>IF reccount('mytable')<6 && or some other number, or use COUNT if you have deleted records
>Thisform.Mygrid.DoScroll(2)
>ENDIF
Thanks Edward
That doscroll is what I was missing. I did this code at startup and whenever I change the order by clicking on colunm header:
lparam tcTable
if !empty(tcTable)
lcSel=Alias()
select (tcTable)
if (This.height - This.headerheight)/This.rowheight > reccount()
This.DoScroll(2)
endif
select (lcSel)
endif