There are at least two ways to do this:
- Draw the scrollable content in an in-memory buffer and copy the desired part of it on the window, depending on scroll. Search for "blit" and gfx.dest in the ReaScript documentation.
- An alternative way is to manually determine which items to show depending on the scroll and only draw those at an appropriate Y position. (I use this method in my GUI scripts "Interactive ReaScript" and "Song Switcher".)
See also gfx.mouse_wheel.