Hi chalky,
I use something like this to position caret/cursor:
Function SetCaretPos(gadget:TGadget, pos:Int = -1) '-1 = end of text
If Not gadget Then Return
If pos = -1 Then
SelectTextAreaText(gadget, TextAreaLen(gadget), 0 )
Else
SelectTextAreaText(gadget, pos, 0 )
EndIf
EndFunction
EDIT:
Didn't notice that you meant Textfields so here is the Win code for setting the position. Notice that if the field is not active, the caret is not shown. You can do that by using ActivateGadget before setting the position.
Local hwnd:Byte Ptr = QueryGadget(textfield, QUERY_HWND)
Local start:Int = 5
Local stop:Int = 5
SendMessageW(hwnd, EM_SETSEL, WParam(start), stop)
-Henri