Forum > Databases

[SOLVED] DBGrid - Center selected row.

<< < (3/3)

Handoko:
That looks good. Unfortunately, I cannot test it because it depends on Windows unit.

lainz:
Windows unit can not be replaced with LCLType, at some extent?

wp:

--- Quote from: Handoko on November 25, 2021, 02:24:20 pm ---That looks good. Unfortunately, I cannot test it because it depends on Windows unit.

--- End quote ---
Replace unit Windows by LCLType and LCLIntf. And replace WM_KEYDOWN/WM_KEYUP by LM_KEYDOWN/LM_KEYUP.

Sieben:
Based on this here idea by 'Soner' I ended up with that little sketch included below that seems to do quite a good job in keeping the selected row of a DBGrid centered. Of course that has to be supended when the user clicks a certain record, but snaps in again asap. And I could not get the grid to agree that the 'natural' center position with an even number of data rows ist the last line of the upper half instead of the first one of the lower. Solution is to make sure that your grid is odd...

Navigation

[0] Message Index

[*] Previous page

Go to full version