Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combo Boxes
Message
From
24/09/2002 07:52:20
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Title:
Miscellaneous
Thread ID:
00703689
Message ID:
00703697
Views:
22
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform