Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Working Incremental Search In Combo Box
Message
 
À
28/07/1998 19:17:46
John Goodrich
John A. Goodrich & Associates
San Jose, Californie, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00122148
Message ID:
00122164
Vues:
19
>After spending a couple days trying to set up an incremental search in a combo box on a grid, with the help of several people from
>the universal thresd, I ended up with a working combo box that does
>the incremental search so I am sending the code I received and
>modified and perhaps it could help someone else.
>
>In the init procedure of the combo box
>

To make it more readable:
fieldname = "none"
aliasname = "none"
WITH This
      .sellength=12
      .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 ]+fieldname+;
	[ AS dummy FROM ]+aliasname+[ where !empty(]+fieldname+ ;
	[) union ] +;
	[SELECT this.displayvalue as dummy ]+;
	[ FROM ]+aliasname+;
	[ INTO cursor q_hardware ORDER BY 1 ]
ENDWITH
WAIT WINDOW "Query is initialized"
<\PRE>
In the interactive change procedure

*This.displayvalue = Upper(Chrtran(Alltrim(This.displayvalue),"yi","IY")) && Local language fix
<PRE>
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
In the lost focus procedure

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

In the when procedure

This.REQUERY

You can make this as entry to file section if you want.
JESS S. BANAGA
Project Leader - SDD division
...shifting from VFP to C#.Net

CHARISMA simply means: "Be more concerned about making others feel good about themselves than you are in making them feel good about you."
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform