Page 1 of 1
Forum

Welcome to the Tweaking4All community forums!
When participating, please keep the Forum Rules in mind!

Topics for particular software or systems: Start your topic link with the name of the application or system.
For example “MacOS X – Your question“, or “MS Word – Your Tip or Trick“.

Please note that switching to another language when reading a post will not bring you to the same post, in Dutch, as there is no translation for that post!



Share:
Notifications
Clear all

[Solved] Lazarus - Fix for: TStringGrid doesn't always scroll to the last row

1 Posts
1 Users
0 Reactions
4,266 Views
 Hans
(@hans)
Famed Member Admin
Joined: 12 years ago
Posts: 2869
Topic starter  

I ran into this little issue when removing rows from a stringgrid (when part of the grid was not visible).
After removing the last line it did not scroll (programmatically) to the last row. Even manually, by using the scrollbar, this did not work well.

The following fixed that problem:

StringGrid1.TopRow:=StringGrid1.RowCount-StringGrid1.VisibleRowCount-1;

However, this comes with a little snafu when adding lines, so when I add lines I use:

StringGrid1.TopRow:=StringGrid1.RowCount-StringGrid1.VisibleRowCount;

   
ReplyQuote
Share: