Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Fast access to index of List property of ComboBox
Message
From
01/04/2002 20:13:07
 
 
To
01/04/2002 19:11:16
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00639728
Message ID:
00639757
Views:
22
I found my error
	  keyval=SEEK(ALLTRIM(this.Text)+chr(nKeyCode),lcalias,lcfield)
>I have a combo box class that I have been working on for a while (with help from other members on the UT) that does a QuickBooks style lookup. It works well, but now a new challenge has arisen.
>
>As my the array that acts as the RowSource for the ComboBox grows, it starts to slow down. I need to find a way to work around this limitation, and think that using an index against the source table from which the array was populated could help...
>
>I try to do this in the IF this.indexed portion of the code below. I fill the array with unsorted data in 'natural' order, so if I find the text in the combo box when I SEEK, the record number should path me back to the LIST index. It seems to work, except if I DON'T find the item I'm looking for, I don't get a visual cue in the input box of the combo box.
>
>I'm trying to 'clone' the ELSE (not indexed) part of the code, that seems to work just fine.
>
>I may be just getting tired, and don't see the obvious.
>
>Any fresh eyes that might be able to offer some pointers would be most appreciated!
>
>
>
>LPARAMETERS nKeyCode, nShiftAltCtrl
>if between(nKeyCode, 32, 122)
>	IF this.indexed
>	  lcAlias = alltrim(This.cRowSourceAlias)
>	  lcField = alltrim(This.cRowSourceField)
>	  keyval=SEEK(ALLTRIM(this.Text),lcalias,lcfield)
>	  IF keyval
>	    nCurPos = this.selstart + 1		
>	    this.Value = this.List(RECNO(lcalias))
>	    this.SelStart = nCurPos
>	    if len(allt(this.list(RECNO(lcalias)))) - nCurPos > 0
>	      this.SelLength = len(allt(this.list(RECNO(lcalias)))) - nCurPos
>	    endif
>	    nodefault
>			
>	  endif
>	ELSE
>	  for x = 1 to this.ListCount
>	   if upper(subs(this.list(x), 1, this.selstart+ 1)) = ;
>	     upper(subs(this.text, 1, this.selstart)+chr(nKeyCode))
>	  	nCurPos = this.selstart + 1
>		this.Value = this.list(x)
>		this.SelStart = nCurPos
>		if len(allt(this.list(x))) - nCurPos > 0
>	   	  this.SelLength = len(allt(this.list(x))) - nCurPos
>		endif
>		nodefault
>		exit
>	  endif
>	 next x
>	ENDIF
>endif
>
>
>
On a CLEAR day you can see forever.
Previous
Reply
Map
View

Click here to load this message in the networking platform