PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: Martin Francom on December 15, 2009, 05:33:23 PM

Title: Question about TextBox Editing/Formating
Post by: Martin Francom on December 15, 2009, 05:33:23 PM
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?
Title: Re: Question about TextBox Editing/Formating
Post by: Paul Squires on December 15, 2009, 06:34:54 PM

   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)


Title: Re: Question about TextBox Editing/Formating
Post by: Martin Francom on December 15, 2009, 07:55:14 PM
Thanks Paul, that's easy.