Buens tardes, asi lo tengo yo y me funciona:
vas a poner el siguiente código en los siguiente eventos del formulario y listbox , haces la prueba:
EN EL EVENTO INIT DEL FORMULARIO
primeramente debes de seleccionar la tabla para enviarla a un cursor con tus condiciones el
SELECT TUSCAMPOS FROM TUTABLA ;
WHERE TUCONDICION INTO CURSOR MICURSOR NOFILTER
EN EL EVENTO GOTFOCUS DEL LISTBOX
this.Value=""
Local cFile, cCampo
Thisform.combo1.lcaps = Capslock()
If Capslock() = .F.
Capslock(.T.) && Fuerzo a mayúsculas
Endif
_Incseek = 0.50
SELECT MICURSOR
cFile = 'MICURSOR' && Tabla o cursor
cField = 'CAMPO' && Campo de la tabla
nLong = LEN(&cField) && Longitud del campo
&& Debemos respetar la longitud original del campo
cCampo = [PADR(upper(ltrim(&cField)), nLong, ' ')]
Select &cCampo As cDato From &cFile Distinct Where !Empty(&cCampo) ;
order By cDato Into Cursor curcombo NOFILTER
thisform.combo1.RowSource = 'curcombo' && Origen de Datos
Keyboard '{ALT+DNARROW}' && Desplegamos lista
IF !EMPTY(thisform.combo1.DisplayValue)
*
cTexto = ALLTRIM(thisform.combo1.DisplayValue)
FOR yy = 1 TO LEN(cTexto)
cLetra = SUBSTR(cTexto, yy, 1)
KEYBOARD cLetra
ENDFOR
*
ENDIF
EN EL EVENTO KEYPRESS DEL LISTBOX
If Between(nKeyCode, 32, 122) OR nKeyCode = 209 && la 'Ñ'
*
* Primero comprueba la lista
For X=1 To This.ListCount
If Upper(Substr(This.List(X), 1, This.SelStart+1)) == ;
upper(Substr(This.Text, 1, This.SelStart)+Chr(nKeyCode))
NCURPOS = This.SelStart + 1
This.Value = This.List(X)
This.SelStart = NCURPOS
This.SelLength = Len(ltrim(This.List(X))) - NCURPOS
This.Comment = SUBSTR(This.List(X),1,NCURPOS)
*
Nodefault
Exit
Endif
Next X
*
* Si no está en la lista
If X > This.ListCount
NCURPOS = LEN(this.Comment) + 1
This.Comment = This.Comment + CHR(nKeyCode)
This.DisplayValue = This.Comment
This.SelStart = NCURPOS
nodefault
ENDIF
*
ENDIF
* Si pulsamos Retroceso o flecha izda.
IF nKeyCode = 127 OR nKeyCode = 19
NCURPOS = LEN(This.Comment) -1
IF NCURPOS < 0
NCURPOS = 0
ENDIF
This.Comment = LEFT(This.Comment, NCURPOS)
This.DisplayValue = This.Comment
this.SelStart = NCURPOS
nodefault
ENDIF
* Si pulsamos 'Inicio'
IF nKeyCode = 1
NCURPOS = 0
this.SelStart = NCURPOS
this.Comment = LEFT(this.DisplayValue, NCURPOS)
this.SelLength = LEN(this.DisplayValue) - NCURPOS
nodefault
ENDIF
* Si pulsamos 'Fin'
IF nKeyCode = 6
NCURPOS = LEN(ALLTRIM(this.DisplayValue))
this.Comment = ALLTRIM(this.DisplayValue)
this.SelStart = NCURPOS
this.SelLength = 0
nodefault
ENDIF
EN EL EVENTO INIT DEL LISTBOX
IF PEMSTATUS(this,'lCaps',5) = .f.
WITH this
.addproperty('lCaps',.f.)
endwith
ENDIF
this.Comment = ''
y no usas en lo absoluto el interactivechange y tu listbox tendrá las coincidencias de las que hablas...
Saludos, espero te sirva!