Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combo Boxes
Message
De
24/09/2002 07:52:20
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Divers
Thread ID:
00703689
Message ID:
00703697
Vues:
24
Hello Robin.

Can anyone remind how to set up a combo box, using a list of values but will also allow the user to enter a value not in the dropdown comblo list

Assuming a RowSourceType of 0-None, code like this in the combo's Init():
WITH This
  .Additem( 'Cleveland' )
  .List[.NewIndex, 2] = 'Ohio'
  .List[.NewIndex, 3] = '44122'
  .Additem( 'Caversham' )
  .List[.NewIndex, 2] = 'England'
  .List[.NewIndex, 3] = 'RG4 8BX'
  .Additem( 'Buffalo' )
  .List[.NewIndex, 2] = 'New York'
  .List[.NewIndex, 3] = '14228'
  .Additem( 'Milwaukee' )
  .List[.NewIndex, 2] = 'Wisconsin'
  .List[.NewIndex, 3] = '43225'
  .AddItem( 'Frostbite Falls' )
  .List[.NewIndex, 2] = 'Minnesota'
  .List[.NewIndex, 3] = '42666'
ENDWITH	
To allow the user to add new items on the fly, make sure that the sombo's style is 0-drop down combo. Code like this in the valid:
IF NOT EMPTY( This.DisplayValue ) AND This.ListIndex = 0
  *** The user typed in something not in the list
  This.AddItem( This.DisplayValue )
ENDIF
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform