************************************************** *-- Class: txtautofill (f:\wwnew\libs\stdtxt.vcx) *-- ParentClass: txtbase (f:\wwnew\libs\basectrl.vcx) *-- BaseClass: textbox *-- Time Stamp: 09/19/05 03:36:06 PM *-- Autofill text box that has functionality to automagically drop the list when it gets focus * DEFINE CLASS txtautofill AS txtbase Height = 23 MaxLength = 20 TabIndex = 10 Width = 150 AutoComplete = 1 AutoCompTable = "data\autocomp.dbf" *-- Used to store the control's real control source to work around a bug in VFP that causes a creash when this is a bound control on a form with a private data session ccontrolsource = "" Name = "txtautofill" *-- Called from the GotFocus() to automagically drop the list PROCEDURE droplist IF EMPTY( This.Value ) KEYBOARD '{SPACEBAR}' PLAIN CLEAR ENDIF ENDPROC *-- Called from the controls Refresh() to update its value from its cControlSOurce PROCEDURE refreshvalue LOCAL lcControlSource WITH This IF NOT EMPTY( .cControlSource ) lcControlSource = .cControlSource .Value = &lcControlSource ENDIF ENDWITH ENDPROC *-- Called from the control's valid to update its cControlSource PROCEDURE updatecontrolsource LOCAL lcAlias, lcControlSource WITH This IF NOT EMPTY( .cControlSource ) lcAlias = JUSTSTEM( .cControlSource ) IF UPPER( LEFT( lcAlias, 4 ) ) = 'THIS' lcControlSource = .cControlSource STORE .Value TO &lcControlSource ELSE REPLACE ( .cControlSource ) WITH .Value IN ( lcAlias ) ENDIF ENDIF ENDWITH ENDPROC PROCEDURE Refresh This.RefreshValue() DODEFAULT() ENDPROC PROCEDURE Init DODEFAULT() *** Unbind the control to work around a bug in VFP *** that causes a crash when it is bound and in a private DS WITH This IF EMPTY( .cControlSource ) .cControlSource = .ControlSource .ControlSource = [] ENDIF ENDWITH ENDPROC PROCEDURE GotFocus DODEFAULT() This.DropList() ENDPROC PROCEDURE Valid This.UpdateControlSource() ENDPROC ENDDEFINE * *-- EndDefine: txtautofill **************************************************