Trying to do an autocomplete feature using a combo box but can't come up with a way of selecting parts of the text in a combo box.
I tried using the FF_TextBox_SetSel , but no luck. (code below)
New to FF, love it so far...
Dim newSS As String
Dim tmpStr As String
Dim i As Integer
Dim j As Integer
newSS = FF_Control_GetText( HWND_FORM1_CBOSEND )
j = FF_ComboBox_GetCount( HWND_FORM1_CBOSEND )
If j > 0 Then
For i = 1 To j
tmpStr = FF_ComboBox_GetText( HWND_FORM1_CBOSEND, i )
If Len(newSS) <= Len(tmpStr) Then
If Left$(tmpStr, Len(newSS)) = newSS Then
FF_Control_SetText( HWND_FORM1_CBOSEND, newSS + Right$(tmpStr,Len(tmpStr) - Len(newSS)) )
FF_TextBox_SetSel( HWND_FORM1_CBOSEND, Len(newSS)+1, Len(tmpStr ) )
'FF_TextBox_SetSel( HWND_FORM1_CBOSEND, 3, 8 )
End If
End If
Next i
End If
Hi Rick,
You have to use the handle of the TextBox that is a child window in the ComboBox. That TextBox has an id = 1001. Try the following to highlight the first 2 characters of the text:
FF_TextBox_SetSel GetDlgItem(HWND_FORM1_COMBO1, 1001), 0, 2
Thanks! That's excellent. Great product, by the way. I'm kicking myself for wasting so much time before I finally purchased it.