This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Hiran's profile picture

ScrollView - any good api?

Started by Hiran, 26 July 2015 - 06:31 PM
Hiran #1
Posted 26 July 2015 - 08:31 PM
Im searching for api that will allow me to create scrollbars etc. Im working on RFTools Dialing Device, and i need either really big monitor to fit in there all my receivers or relatively small one, but with ability to scroll contents.

I know that oeed's Bedrock has that, but its documentation is like - "here is how you create buttons, labels and other simple stuff. Everything else figure on your own" and looking at the code didn't really help me that much.
Edited on 26 July 2015 - 06:35 PM
HPWebcamAble #2
Posted 26 July 2015 - 09:12 PM
There isn't a great way to do actual scroll bars, there's a lot of math involved.

I just do a paged system, I figure out how many 'items' each page can have (say you've got 15 lines for items to be displayed - that would be 15 per page), then how many pages there are ( math.ceil( totalItems/perPage ) )

The first page can display the first 15 items, the next page would have the next 15, and so on, until the last page has 15 or less items.
Edited on 26 July 2015 - 07:13 PM
flaghacker #3
Posted 26 July 2015 - 09:17 PM
Maybe this topic can get you started.
Edited on 26 July 2015 - 07:18 PM