Edit:cut()method


Cut the Edit current selected text to the clipboard. If no current selection exists, nothing is cut to the clipboard.

Return value

This function returns no value.

Example

--! luart-extensions import ui -- create a fixed Window to hold the buttons local win = ui.Window("Edit:cut() sample", "fixed", 420, 230) local label = ui.Label(win, "Enter text : ", 10, 10) local edit = ui.Edit(win, "", label.x + label.width + 8, label.y) local button = ui.Button(win, "Cut text", edit.x + edit.width + 8, edit.y) function button:onClick() edit:cut() ui.info("You have cut '"..sys.clipboard.."' to the clipboard") end win:show() -- update user interface repeat ui.update() -- enabled 'cut' button only if Edit current selection is not nil button.enabled = edit.selection.text ~= "" until not win.visible