Edit:copy()method


Copies the Edit current selection to the Windows clipboard. If no current selection exists, nothing is copied 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:copy() 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, "Copy text", edit.x + edit.width + 8, edit.y) function button:onClick() edit:copy() ui.info("You have copied '"..sys.clipboard.."' to the clipboard") end win:show() -- update user interface repeat ui.update() -- enabled 'copy' button only if Edit current selection is not nil button.enabled = edit.selected ~= nil until not win.visible