Type Function Object TextField Library native.* Return value none Revision Release 2024.3703 Keywords getSelection See also native.newTextField()
Returns the cursors first and last position.
object:getSelection()
local textField = native.newTextField( 160, 240, 280, 40 ) textField.text = "asdf" native.setKeyboardFocus( textField ) local start, finish = textField:getSelection() -- if native cursor is placed after the "f" in the text, start and finish would return 4, 4 -- if native cursor is selecting the whole text, start and finish would return, 0, 4