I would like to build in some editing/formating when text is enter in a textbox. This is what I am doing:
'--------------------------------------------------------------------------------
Function FORMDOCINFO_TXTDOCLNAME_EN_CHANGE ( _
ControlIndex As Long, _ ' index in Control Array
hWndForm As Dword, _ ' handle of Form
hWndControl As Dword, _ ' handle of Control
idTextControl As Long _ ' identifier of text control
) As Long
Local s As String
s = FF_TextBox_GetText (HWND_FormDOCinfo_txtDOClname)
s = UCase$(Left$(s,1)) & Mid$(s,2)
FF_TextBox_SetText (HWND_FormDOCinfo_txtDOClname, s)
End Function
The problem is that after each key press the cursor is repositioned at the beginning of the text in the textbox. How can I ensure the cursor is positioned at the end of the text in the textbox? Can this be done?
Local s As String
s = FF_TextBox_GetText(hWndControl)
s = UCase$(Left$(s,1)) & Mid$(s,2)
FF_TextBox_SetText hWndControl, s
' Set caret to the end of the text
FF_TextBox_SetSel hWndControl, Len(s), Len(s)
Thanks Paul, that's easy.