Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Combobox question
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00584131
Message ID:
00584540
Views:
40
>Thanks for the explanation Jim. Could you please ellaborate and/or give an example of what you mean for, "do your own data binding in the LostFocus and GotFocus of the combo and forget about the ControlSource property" because the behaviour you describe is what I'm after -- Allow the user to choose from the list or enter a value but the new value is not added to the list. This is because the users want to be able to enter what they want but the "master" list can only be updated by a superuser.

Colin,

By add to the list I am referring to the internal list of the combobox not the list that that comes from. For example;
* ComboBox Valid
IF This.Value <> This.DisplayValue
   * Add item to combo
   This.AddListItem( ... )
ENDIF
This will cause the internal list of the combo to have the value that the user typed in only until the combo is destroyed. When the form is next loaded the combo will again only contain the items in the "master" list. Your added item is only temporary to allow the default data binding to work.

If you want ot use your own data binding, here's how I do it.

I add a property to my combobox class named cUpdateField. In this property I put the name of the field to be bound to the combobox. In the class's GotFocus I set the DisplayValue for the combo to the contents of the UpdateField and in the LostFocus I set the Updatefield to the DisplayValue of the combobox. Something like;
* Combo GotFocus
lcField = This.UpdateField
This.DisplayValue = &lcField
* Combo LostFocus
REPLACE (this.UpdateField) WITH This.DisplayValue
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform