Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- shell.run("ui.lua")
- local renderer = Renderer.new()
- renderer:setScrollable(true)
- renderer:setScrollHeight(renderer.height + 15)
- local button = Button.new()
- renderer:add(button)
- local overlayText = Content.new(term.getSize())
- renderer:add(overlayText)
- local function writeInButton(text)
- local content = button:getContent()
- content:clear()
- content:newLine()
- content:setTextColor(colors.white)
- content:addLine(text, "center")
- end
- button:setPosition({1, 7})
- button:setColor(colors.blue)
- button:setSize(20, 4)
- button:setLayer(5)
- button:setAttr("clicked", false)
- writeInButton("Hello, world!")
- button:setOnClick(function()
- if not button:getAttr("clicked") then
- writeInButton("Clicked :)")
- button:setAttr("clicked", true)
- setTimeout(function()
- writeInButton("Not clicked :(")
- button:setAttr("clicked", false)
- renderer:forceRender()
- end, 1)
- end
- end)
- overlayText:setTextColor(colors.white)
- overlayText:setPosition({0, 12})
- overlayText:write("This is a long string as a test!")
- overlayText:setPosition({0, 30})
- overlayText:write("And this string cannot be seen without scrolling!")
- overlayText:setLayer(2)
- renderer:execute()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement