Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo vs. Drop down lists
Message
De
10/01/2000 04:53:35
Jill Derickson
Software Specialties
Saipan, CNMI
 
 
À
10/01/2000 04:09:56
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00314890
Message ID:
00315366
Vues:
26
Thanks Marcia, I'll be taking a look at it.

J
>Hi Jill.
>
>>> Now I have a situation where I want the user to easily add a value to both the list and underlying source table. If I use a combo, I can detect a new value and add it, but the incremental search feature, for existing values is lost. <<
>
>I have a QuickFill combo box class that has this code in its InteractiveChange method:
>
>
>IF This.SelStart > 0
>  IF ( LASTKEY() > 31 AND LASTKEY() < 128 ) OR ( LASTKEY() = 7 )
>    This.HandleKey()
>  ENDIF
>ENDIF
>
>
>This goes in HandleKey():
>
>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
>
>
>Then, in the valid of the instance, I have code like this:
>
>IF This.ListIndex = 0 AND !EMPTY( This.DisplayValue)
>  *** The user typed in a new entry
>  *** Take action here to add the new entry
>  *** To the combo's RowSource
>  *** Requery the combo afterwards
>  *** and reset its value to the newly entered item
>ENDIF
>
>
>Marcia
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform