Keyboard:cursor()
フォーカス中のテキストフィールドで、テキストカーソルを指定した文字位置へ移動します。
シグネチャ
Keyboard:cursor(position: number): void
パラメータ
| パラメータ | 型 | 説明 |
|---|---|---|
| position | number | フィールドの先頭からの文字オフセット。0 は最初の文字の前 |
戻り値
void
説明
位置は現在のテキストの長さに合わせて制限されます。カーソル移動にはユーザー補助モードが必要です。ネイティブ(ROOT)モードでは、シェルがカーソルを確実に配置できないため、呼び出すとエラーになります。
例
Keyboard:type("Hello world")
Keyboard:cursor(5) -- before the space
Keyboard:type(" there") -- "Hello there world"
対応バージョン: 1.0.0.37 以上