Posted 25 February 2015 - 02:51 PM
Hello,
I was thinking let's start with a Scroll Program.
But what I got so far is like the draw part for the table it should print
and thats it. What I want is a line on the right side of the screen where you can
scroll with. Like I know how to make it scroll. But I dont know how to count the (blue) line.
Like what you can pull down with mouse_drag to scroll too.
This is the code I got so far:
I hope someone can help me with this. If you need some more information be free to ask.
Thankyou,
Jasper
I was thinking let's start with a Scroll Program.
But what I got so far is like the draw part for the table it should print
and thats it. What I want is a line on the right side of the screen where you can
scroll with. Like I know how to make it scroll. But I dont know how to count the (blue) line.
Like what you can pull down with mouse_drag to scroll too.
This is the code I got so far:
local startY = nil
local endY = nil
local eTable = {}
term.setBackgroundColor(colors.white)
term.clear()
term.setTextColor(colors.black)
function countLines()
if startY and endY then
som = endY / 19
return som
end
end
function drawScrollBar(barColor)
if endY ~= nil then
if barColor then
term.setBackgroundColor(barColor)
else
term.setBackgroundColor(colors.blue)
end
Lines = countLines()
for i = 1,Lines do
term.setCursorPos(28,i)
term.write(" ")
end
end
end
function newScroll(X,Y,table,barColor)
startY = Y
eTable = table
if type(eTable) == "table" and #eTable ~= nil then
for i = 1, #eTable do
term.setCursorPos(X,Y)
term.write(eTable[i])
Y = Y + 1
end
if Y > 19 then
endY = Y
end
if barColor then
drawScrollBar(barColor)
else
drawScrollBar()
end
end
end
sTable = {"Jasper","example","Jasper","example","Jasper","example","Jasper","example","Jasper","example","Jasper","example",
"Jasper","example","Jasper","example","Jasper","example","Jasper","example"}
newScroll(1,1,sTable)
I hope someone can help me with this. If you need some more information be free to ask.
Thankyou,
Jasper