EditBox:SetCursorPosition

From Warcraft Wiki
Jump to navigation Jump to search

Sets the position of the cursor in the edit box.

EditBox:SetCursorPosition(cursorPosition)

Arguments

cursorPosition
number - The new editing cursor position; the cursor is set after position'th character of the string.

Example

This can be used to scroll edit boxes displaying long strings.

local editBox = CreateFrame("EditBox", "WPDemoBox", UIParent, "InputBoxTemplate")
editBox:SetSize(100, 20)
editBox:SetPoint("CENTER")
editBox:SetAutoFocus(false)
editBox:SetText("Can't beat my, can't beat my, // No you can't beat my leather shoes. // I have got some leather shoes...")
editBox:SetCursorPosition(0) -- display the beginning of the text instead of the end