event.startPosition

类型 数字
事件 userInput
修订 版本 2024.3703
关键词 userInput, startPosition

概述

事件发生时光标所在的位置。

陷阱

此属性仅在 userInput 事件的 "editing" 阶段 可用。

示例

local function textListener( event )
    if ( event.phase == "editing" ) then
        print( event.startPosition )
    end
end

defaultField = native.newTextField( 150, 150, 180, 30 )
defaultField:addEventListener( "userInput", textListener )