Move Cursor to TexField

ios

#1

Hello,

I have a searchbar that is receiving input from a barcode scanner (attached as a keyboard) and would like the scanning to be as intuitive as possible. Right now every time you want to scan something, you need to manually put the cursor on the searchbar. I would ideally like to be able to programmatically force the cursor back to the input so you can just continue scanning.

Any way to do this with {N}?

My searchbar looks like this:
<SearchBar (propertyChange)=“search(sb.text)” #sb hint=“Search” class=“searchbar” (clear)=“onClear()” [text]=“searchPhrase” (submit)=“search(sb.text)”>


#2

I’m not sure what is causing your SearchBar to loose focus. But did you try .focus() method?


#3

Yep, just tried it now and it’s working, thanks!