Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best way to set default value for combobox?
Message
De
11/10/2000 16:18:16
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00427909
Message ID:
00428073
Vues:
31
>>>If you have a combobox, which is dropdown list, after you make your selection, how can you return to default (empty state)?
>>>Suppose, you have a field in your main table, which may contain a coded value or could be empty. For this field you use a combobox (drop down list). Suppose, you choose something. How then could you return it back to empty state? Seems there is no way, unless you would code some event to do so, say, Right Click.
>>
>>You'd have to include an empty member of the row source.
>>e.g.,
>>
WITH thisform
>>  DIMENSION .aRow(3)
>>  .aRow[1] = ""
>>  .aRow[2] = "hello"
>>  .aRow[3] = "world"
>>  .cboCombo.RowSourceType = 5
>>  .cboCombo.RowSource = "thisform.aRow"
>>  .cboCombo.Requery()
>>
>>** or
>>  .cboCombo.RowSourceType = 1
>>  .cboCombo.RowSource = ",hello,world"
>>  .cboCombo.Requery()
>>
>>ENDWITH
>
>Trey,
>
>The RowSource for this combobox is a select statement and it selects from Lookups table, which don't have empty record. What should I do in this case?

Add a UNION to the SELECT with empty values for the same fields in the SELECT.
e.g.
SELECT cname, ccity, nage FROM people ;
  UNION ;
 SELECT "" AS cname, "" AS ccity, 0 AS nage ;
  FROM people ;
  INTO CURSOR cuRowSource
As long as the empty row select is the last select, then you shouldn't have the problems that would come up with field widths - like the typical ALLTRIM() problems where the first row returned has a shorter trimmed length than other records
Insanity: Doing the same thing over and over and expecting different results.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform