Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP6SP5 - Unselect Combo selection
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00795134
Message ID:
00795572
Views:
64
This message has been marked as a message which has helped to the initial question of the thread.
Maybe I missed explaining but I have a autocomplete combo. So the whole logic hinges on a joined character field in the view. In the end the whole thing will be based in the iID as the connecting link, which is what I am replacing in the ReplaceID().

This is all very confusing. All you need is to call this method from your KeyPress to handle auto complete:
LOCAL lcSofar, lnSelStart, lnSelLength, lnRow

WITH This
  *** Handle backspace key
  IF LASTKEY() = 127
    .SelStart = .SelStart - 1
  ENDIF	
  *** Get the value typed in so far
  lnSelStart = .SelStart
  lcSofar =  LEFT( .DisplayValue, lnSelStart ) 
  *** Find a match in column #1 of the combo's internal list
  FOR lnRow = 1 TO .ListCount
    IF UPPER( .List[ lnRow, 1 ] ) = UPPER( lcSoFar )
      .ListIndex = lnRow
      EXIT
    ENDIF
  ENDFOR		
  *** Highlight the portion of the value after the insertion point
  .SelStart = lnSelStart
  lnSelLength = LEN( ALLTRIM( .DisplayValue ) ) - lnSelStart 
  IF lnSelLength > 0
    .SelLength =  lnSelLength	
  ENDIF	
ENDWITH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform