Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Box IncrementalSearch
Message
De
23/07/1998 13:33:25
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
23/07/1998 13:28:42
John Goodrich
John A. Goodrich & Associates
San Jose, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00120581
Message ID:
00120589
Vues:
21
>I am having a heck of a time getting the IncrementalSearch in my combo box to work properly.
>
>If I don't scroll down and type in the complete text exactly as it is
>in the key field it finds it. If it isn't exactly right it goes to the
>top of the file.
>
>If I scroll down I can only type in the first character and it goes
>to the first character example in an alphabetic file if I enter R
>it goes to R but I cannot enter the second character.
>
>I have incrementalsearch=.t., I have also changed the _DBLCLICK values
>from .05 to 5.5. I changed the key field from regular to candidate
>and back reindexing between each change.
Below is an *unfinished* class that may help you :
**************************************************
*-- Class:        cmbself_edit (c:\vfpclasses\global.vcx)
*-- ParentClass:  combobox
*-- BaseClass:    combobox
*
DEFINE CLASS cmbself_edit AS combobox


	Height = 22
	Width = 100
	DisabledBackColor = RGB(255,255,255)
	aliasname = "None"
	fieldname = "None"
	Name = "cmbself_edit"


	PROCEDURE InteractiveChange
		*This.displayvalue = Upper(Chrtran(Alltrim(This.displayvalue),"yi","IY")) && Local language fix
		with this
			if .selstart = 0
				return
			endif
			cPos = .selstart
			if lastkey() = 127 && Backspace
				if .selstart = 1
					.displayvalue = ""
					.selstart = 0
					.sellength = 0
					return
				endif
				cCheckValue = left(.displayvalue,.selstart-1)
				cPos = cPos - 1
			else
				cCheckValue = iif(cPos = 1,"",left(.displayvalue,cPos-1))+chr(lastkey())
			endif
			lExistsOne = .f.
			for ix = 1 to .listcount
				if  Upper(Alltrim(.list(ix))) = upper(alltrim(cCheckValue))
					.displayvalue = .list(ix)
					lExistsOne = .t.
					exit
				endif
			endfor
			.selstart = cPos
			if lExistsOne         && Available item
				.sellength = len(.displayvalue) - cPos
			else
			    .sellength = 0
			endif
		endwith
	ENDPROC


	PROCEDURE When
		THIS.REQUERY
	ENDPROC


	PROCEDURE LostFocus
		*This.displayvalue = Upper(Chrtran(Alltrim(This.displayvalue),"yi","IY")) && Local language fix
		this.value = this.displayvalue
		this.displayvalue = this.value
	ENDPROC


	PROCEDURE Init
		WITH This
			.rowsourcetype = 3
			if lower(.fieldname)="none" or ;
				lower(.aliasname)="none"
				.fieldname = substr(.controlsource,rat(".",.controlsource)+1)
				.aliasname = substr(.controlsource,1,;
								rat(".",.controlsource)-1)
			endif
			.rowsource = [SELECT DISTINCT ]+THIS.fieldname +;
				[ as dummy FROM ]+this.aliasname+[ where !empty(]+THIS.fieldname + ;
				[) union ] +;
				[SELECT this.displayvalue as dummy ] +;
				[ FROM ]+this.aliasname + ;
				[ INTO cursor qq order by 1 ]
		ENDWITH
	ENDPROC


ENDDEFINE
*
*-- EndDefine: cmbself_edit
**************************************************
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform