Recent

Author Topic: How to low level manage Scrollbar  (Read 337 times)

Tommi

  • Sr. Member
  • ****
  • Posts: 256
How to low level manage Scrollbar
« on: January 16, 2026, 09:30:34 am »
I have built a simple Hex editor. My goal is to open big files without lagging, like XVI32 on Windows, but I am using Linux (Ubuntu Cinnamon 24.04). To do that I would like to refill a TStringrid with just few cells any time the scrollbar slides. To emulate this effect actually I am using a vertical TTrackBar. But the result is not optimal because when I use arrows on the grid, I hurt against the end of page and I cannot go to the next.

I'd like to give to the scrollbar the function that actually has TTrackBar, so I have the same effect with arrow also.

I attach my code fo reference.

Thank you

creaothceann

  • Sr. Member
  • ****
  • Posts: 257
Re: How to low level manage Scrollbar
« Reply #1 on: January 16, 2026, 10:30:26 am »
I would like to refill a TStringrid with just few cells any time the scrollbar slides. To emulate this effect actually I am using a vertical TTrackBar. But the result is not optimal because when I use arrows on the grid, I hurt against the end of page and I cannot go to the next.

Write a handler for the TStringrid's OnKeyDown that checks if the current cell is e.g. at the bottom + the key that was pressed is VK_Down. Then you can "scroll" the content and set Key to zero.

Tommi

  • Sr. Member
  • ****
  • Posts: 256
Re: How to low level manage Scrollbar
« Reply #2 on: January 16, 2026, 04:05:54 pm »
OK, thank. It works. I made it so also with StringGrid1MouseWheelUp and StringGrid1MouseWheelDown.

:)

 

TinyPortal © 2005-2018