************************************************** *-- 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