Edit:scroll(amount) method
Scrolls the Edit text vertically.
Parameters
amount
A string
value, representing the the amount of vertical scrolling :
"top"
: scrolls the text to the upper left."bottom"
: scrolls the text to the lower right."lineup"
: scrolls the text one line up."linedown"
: scrolls the text one line down."pageup"
: scrolls the text one page up."pagedown"
: scrolls the text one page down.
Return value
This function returns no value.Example
local ui = require "ui"
-- create a simple Window
local win = ui.Window("Edit.scroll sample", "fixed", 640, 480)
local cb = ui.Combobox(win, {"Scroll to top", "Scroll to bottom", "Scroll one line up", "Scroll one line down", "Scroll one page up", "Scroll one page down"})
local edit = ui.Edit(win, "", 0, 0, 480, 480)
cb:center()
cb.width = 140
cb.x = math.floor(edit.width+(640-edit.width-cb.width)/2)
edit:load(arg[0])
edit.text = edit.text..edit.text
local values = {
["Scroll to top"] = "top",
["Scroll to bottom"] = "bottom",
["Scroll one line up"] = "lineup",
["Scroll one line down"] = "linedown",
["Scroll one page up"] = "pageup",
["Scroll one page down"] = "pagedown"
}
function cb:onSelect()
edit:scroll(values[cb.text])
end
ui.run(win):wait()