Edit:undo() method


Undoes the last edit operation on the Edit.

Return value

This function returns no value.

Example

local ui = require "ui" -- create a fixed Window to hold the buttons local win = ui.Window("Edit:undo() sample", "fixed", 290, 220) local label = ui.Label(win, "Enter text : ") local edit = ui.Edit(win, "", label.x + label.width + 8, label.y-4, 150) local button = ui.Button(win, "Undo", edit.x + edit.width + 8, edit.y) function button:onClick() edit:undo() end win:show() -- update user interface repeat ui.update() -- enabled button only if edit.canundo is true button.enabled = edit.canundo and true or false until not win.visible