Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combos
Message
De
28/05/1997 11:04:51
Bob Lucas
The WordWare Agency
Alberta, Canada
 
 
À
28/05/1997 10:09:19
Holly Clawson
Travelcenters of America
Westlake, Ohio, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Titre:
Re: Combos
Divers
Thread ID:
00033818
Message ID:
00033845
Vues:
38
>Help!! I have this combo box that is an array. When I key data into the combo it will stay displayed until I leave or tab to a new field. How do I get this to stay displayed?
>
>Holly Clawson

The combo box displays data stored in an internal array which is part of the combo box structure. There are two types of boxes, combos and lists. The basic difference is that list boxes only allow you to select from the items in the internal array (this is not entirely true when the record source is a table).

Some of the problems I see with combo boxes may relate back to design philosphy. I almost always (if not always) use combos as a pick list. I don't allow data entry because I think it is confusing, but then that may depend on the case. I have a very common combobox that displays provinces and states (Alberta, Canada, Arkansas, USA) etc. In fact I have subclassed this object. It gets its values from an array that has three columns, the display value, the province/state, and country. The combo box uses the first array column to display data but I bind the second column (province/state such as AB, NY, etc) to the value of the combo because this is the value I want to store. Therefore I set the bound column property to 2. This means that the displayvalue and value properties do not have the same value. This also means if I set the value to 'NY' the displayvalue becomes 'New York, USA'

If I were to allow NEW entries to this combo box I would have to consider the following. The user is modifying the displayvalue. IF they enter an existing value my combo box will find the matching value based on the recordsource. If it is a new value I had better do something with it (add it to a table or the array) or else it will 'blank out' because the combo box can't find the data in its recordsource. If your record source was an array, you must add the data to the array (dimension the array to the array length + 1). Having done that, the array now has all the data, but the combobox which loaded its internal structures from the array, does. Now you can use additem (and listindex and stuff) to update the combo or you can call the combo requery method to reload the recordsource array. This will add the new item to the array.

If you have a one dimension array or a bound column of 1, your displayvalue and value are the same. But if your bound column is greater than one, they will be different. This is what makes them most useful!

I agree that combos are difficult, and even after spending a few days mastering them, you don't touch them for a while and soon forget all the complexities. They are actually easy to use and are well designed (except when your values are numeric!).

Hope this helps.

Bob
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform