************************************************** *-- Class: cmbself_edit (c:\commonlib\global.vcx) *-- ParentClass: combobox *-- BaseClass: combobox *-- Time Stamp: 08/27/98 11:13:08 AM * Define CLASS cmbself_edit AS combobox Height = 22 Width = 100 DisabledBackColor = RGB(255,255,255) aliasname = "None" fieldname = "None" Name = "cmbself_edit" Procedure GotFocus This.REQUERY && Do we have new elements ? This.value = eval(this.controlsource) && Reposition Endproc Procedure InteractiveChange * * Self note : Restudy this code * *This.displayvalue = ; * Chrtran(This.displayvalue,"ýi","IÝ") && 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 LostFocus *This.displayvalue = ; * Chrtran(This.displayvalue,"ýi","IÝ") && 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" && Lookup is same as controlsource alias .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 + ; [ union ] +; [SELECT this.value as dummy ] +; [ FROM ]+this.aliasname + ; [ INTO cursor qq order by 1 ] If .parent.baseclass = "Column" .parent.sparse = .t. && Force sparse .t. for grids Endif Endwith Endproc Enddefine * *-- EndDefine: cmbself_edit **************************************************Cetin