>I am just trying to get the native combobox to work in a more typical setting, say a dropdown list of part numbers and descriptions for several hundred items at most. Probably a pretty common scenario for invoices.
>
>So while the native combobox might hit some limitations with hundreds of thousands of rows, I am just trying "to walk before I run", and not taxing it at all.
>
>But its quirky behaviors make it pretty much useless, as I would be embarrassed to deliver an application with a dropdown that "works" like this one.
>
>I do appreciate the recommendation to try downloading an alternate combo class that someone has been kind enough to develop and share! It just frustrates me that after all the versions of VFP (3 thru 9), that such an important native class does not work as the masses would expect... And that I just happen to pick it on the very forst form I try to design as a newbie :(
>
>I wonder, has there ever been an enhancement request/bug report made to Microsoft to fix this issue? Does Microsoft VFP's developers ever communicate with this forum?
>
>
>
>
>>Frankly the combo box is not the greatest control. It's often abused. How do I put 400,000 customers in a combobox is a far too frequently asked question.
>>
>>I use Visual MaxFrame and it includes a textbox that replaces the combobox.
>>
>>There are combobox classes that can be found in the download section of the UT. Maybe one of them will work for you?
This object was designed in VFP 7 but with some tweaking should be able to do an incremental search just fine using the standard combobox. I took this code directly out of my VCX and dropped a few routines which you will need to add; maybe (restorewindowpos and savewindowpos). This works as a toolbar connecting to whatever form, and whatever object to perform the search. I use it to search in a grid of many records.
#INCLUDE "c:\...\include.h"
DEFINE CLASS ctbrlookup AS toolbar
Caption = "Lookup List"
Height = 28
Left = 0
Sizable = .F.
Top = 0
Width = 298
ControlBox = .F.
oparentform = .NULL.
oparentobject = .NULL.
Name = "ctbrlookup"
nincseek = .F.
ltimer = .F.
lerroroccurred = .F.
lerroroverride = .F.
ADD OBJECT cmblist AS combobox WITH ;
FontName = "Arial", ;
FontSize = 10, ;
RowSourceType = 6, ;
Height = 22, ;
Left = 5, ;
Style = 2, ;
ToolTipText = "Type to search through list...", ;
Top = 3, ;
Width = 288, ;
DisplayCount = 20, ;
Name = "cmbList"
ADD OBJECT tmrlookup AS timer WITH ;
Top = 3, ;
Left = 292, ;
Height = 0, ;
Width = 0, ;
Name = "tmrLookup"
PROCEDURE updatetoolbar
LPARAMETERS toParentForm
LOCAL lnSelect, lcAlias, lnRecno
WITH THIS
IF PARAMETERS() >= 1
SET DATASESSION TO toParentForm.DATASESSIONID
.oParentForm = toParentForm
lcAlias = ""
lnRecno = 0
IF TYPE("toParentForm.oColumn") = "O"
.oParentObject = toParentForm.oColumn
lcAlias = .oParentObject.ControlSource
lcAlias = SUBSTR(lcAlias, 1, AT(".", lcAlias)-1)
ELSE
.oParentObject = NULL
ENDIF
IF !EMPTY(lcAlias) AND USED(lcAlias)
SELECT (lcAlias)
lnRecno = IIF(BOF() OR EOF(), 0, RECNO())
ELSE
lcAlias = ""
lnRecno = 0
ENDIF
ENDIF
lnSelect = SELECT()
DO CASE
CASE PARAMETERS() < 1 OR EMPTY(lcAlias) OR RECCOUNT(lcAlias) = 0
.cmbList.ROWSOURCE = NULL
.cmbList.CONTROLSOURCE = NULL
.cmbList.VALUE = NULL
.cmbList.TOOLTIPTEXT = "Lookup List is not available."
CASE PARAMETERS() >= 1 AND !EMPTY(lcAlias) AND ;
VARTYPE(EVAL(toParentForm.oColumn.ControlSource)) = "C" AND ;
INLIST(UPPER(ALLTRIM(.oParentObject.Class)), "CTXTORDERCOLUMN", "CEDTORDERCOLUMN")
.cmbList.FORMAT = "!"
.cmbList.ROWSOURCE = .oParentObject.ControlSource
.cmbList.CONTROLSOURCE = .oParentObject.ControlSource
.cmbList.VALUE = EVAL(.oParentObject.ControlSource)
.cmbList.TOOLTIPTEXT = ""
IF lnRecno > 0
GOTO lnRecno
ELSE
GO TOP
ENDIF
.cmbList.REFRESH()
OTHERWISE
.cmbList.ROWSOURCE = NULL
.cmbList.CONTROLSOURCE = NULL
.cmbList.VALUE = NULL
.cmbList.TOOLTIPTEXT = "Lookup List is not available for this datatype."
ENDCASE
ENDWITH
SELECT (lnSelect)
ENDPROC
PROCEDURE Init
DODEFAULT()
THIS.DOCK(TOOL_TOP)
ENDPROC
PROCEDURE Destroy
THIS.ENABLED = .F.
ENDPROC
PROCEDURE cmblist.KeyPress
LPARAMETERS nKeyCode, nShiftAltCtrl
This.Parent.tmrLookup.Reset()
ENDPROC
PROCEDURE cmblist.GotFocus
DODEFAULT()
WITH THIS.Parent
.nIncSeek = _INCSEEK
_INCSEEK = .75
.tmrLookup.Interval = _INCSEEK * 1000
ENDWITH
ENDPROC
PROCEDURE cmblist.LostFocus
WITH THIS.Parent
.tmrLookup.Interval = 0
_INCSEEK = .nIncSeek
ENDWITH
DODEFAULT()
ENDPROC
PROCEDURE cmblist.InteractiveChange
WITH THIS.Parent
.tmrLookup.Reset()
DODEFAULT()
.lTimer = .T.
ENDWITH
ENDPROC
PROCEDURE tmrlookup.Timer
LOCAL lcBaseClass, llLockScreen, lnTimer
WITH THIS.PARENT
IF .lTimer AND !CHRSAW()
lnTimer = THIS.Interval
THIS.Interval = 0
.lTimer = .F.
llLockScreen = .oParentForm.LOCKSCREEN
lcBaseClass = UPPER(.oParentObject.BASECLASS)
DO CASE
CASE lcBaseClass == "COLUMN"
WITH .oParentObject.PARENT
.AFTERROWCOLCHANGE(.ACTIVECOLUMN)
ENDWITH
ENDCASE
.oParentForm.LOCKSCREEN = llLockScreen
THIS.Interval = lnTimer
ENDIF
ENDWITH
ENDPROC
ENDDEFINE