Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Combobox.value in grid gets incorrect value
Message
De
07/08/2006 06:20:19
 
 
À
06/08/2006 23:19:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
01143347
Message ID:
01143385
Vues:
21
By the way, the controlsource of combobox is in a different table than the grid's ControlSource but the tables are related.

My gut feeling is that it is the relation that is causing the problem, but I can't tell you why < s >. Unless you need to be able to add new items to the combo on the fly (i.e., you need a combo with style = 0 - drop down combo), why don't you ditch the relation an set up the column with the combo like this instead:

Bound = .F.
ControlSource = ( IIF( SEEK( RecordSource.FK_field, 'lookup_table', 'lookup_tag' ), lookup.Description_field, '' ) )

The combo needs to be populated from the lookup table and its ControlSource set to the PK of the lookup table. Do not use a RowSourceType of 6-fields for the drop down list or it will be blank when it gets focus. This appears to be a bug that only occurs when you use a combo in a grid in this fashion, binding it to a foreign key value in the underlying data while displaying the descriptive text from a lookup table.

At this point you are probably saying to yourself “Hang on, there! Setting up the column’s ControlSource like that has the side effect of making the column ReadOnly!” and you would, in fact, be correct. However, when you run the example, you will see that you can still drop the list and make changes to the client for the current contact. The reason for this is that the ReadOnly attribute applies only to the portion of a control that accepts text. Since a drop down list does not accept text, it cannot be made read only (any more than a command button could be made read only). Fortunately, this behavior is documented and is by design so it is unlikely to change in future releases of the product.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform