>************************************************** >*-- Class: cbonotinlist >*-- ParentClass: combobox >*-- BaseClass: combobox >*-- Time Stamp: 12/12/99 06:38:09 PM >*-- allows selection of an item not in the combo's list to be used as its controlsource...only works if the combo's bound column is 1 >* >DEFINE CLASS cbonotinlist AS COMBOBOX > > *-- Used to save the control source of the combo before the control is unbound > ccontrolsource = "" > NAME = "cbonotinlist" > > > *-- Called from Valid...it updates the "bound" field > PROCEDURE updatecontrolsource > LOCAL lcAlias, lcControlSource > WITH THIS > IF ! EMPTY( .ccontrolsource ) > lcAlias = JUSTSTEM( .ccontrolsource ) > IF UPPER( ALLTRIM( lcAlias ) ) = 'THISFORM' > lcControlSource = .ccontrolsource > STORE .DISPLAYVALUE TO &lcControlSource > ELSE > REPLACE ( .ccontrolsource ) WITH .DISPLAYVALUE IN ( lcAlias ) > ENDIF > ENDIF > ENDWITH > > ENDPROC > > > *-- Updates display value from the field in the underlying table if this is a "bound" control > PROCEDURE refreshdisplayvalue > LOCAL lcControlSource > WITH THIS > IF ! EMPTY( .ccontrolsource ) > lcControlSource = .ccontrolsource > .DISPLAYVALUE = &lcControlSource > ENDIF > ENDWITH > ENDPROC > > > PROCEDURE INIT > IF DODEFAULT() > WITH THIS > .ccontrolsource = .CONTROLSOURCE > .CONTROLSOURCE = '' > ENDWITH > ENDIF > ENDPROC > > > PROCEDURE VALID > THIS.updatecontrolsource() > ENDPROC > > > PROCEDURE REFRESH > THIS.refreshdisplayvalue() > ENDPROC > > > PROCEDURE GOTFOCUS > IF LOWER( THIS.PARENT.BASECLASS ) = 'column' > *** This is needed so it will work in a grid > COMBOBOX::GOTFOCUS() > THIS.refreshdisplayvalue() > NODEFAULT > ELSE > DODEFAULT() > ENDIF > ENDPROC > > >ENDDEFINE >