FoxPro/Visual FoxPro - ¿Como buscar palabras en un combobox?

 
Vista:
sin imagen de perfil

¿Como buscar palabras en un combobox?

Publicado por Jose (49 intervenciones) el 03/02/2016 19:18:40
Hola amigos, como puedo buscar una palabra en un combobox? Necesito básicamente simular la función LIKE de sql pero en los registros del combobox, para así poder buscar palabras sin que importe su posición en cada registro.
El siguiente código me permite buscar palabras pero no en toda la cadena de caracteres de cada registro sino que hace solamente un Autoincrement, aquí es donde quiero hacer lo que hace el LIKE de sq:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
*EVENTO KEYPRESS
Lparameters nKeyCode, nShiftAltCtrl
*
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
 
IF nKeyCode = 13
	this.lostfocus
endif
Nota: Lo que intento conseguir es un Buscador en un combobox el cual cargo con un cursor.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder