Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Which methods to populate and keep fresh a list box
Message
De
14/01/2000 22:31:31
Charlie Schreiner
Myers and Stauffer Consulting
Topeka, Kansas, États-Unis
 
 
À
14/01/2000 15:06:36
Gail Heineman
Alaska Dept of Fish and Game
Anchorage, Alaska, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00318308
Message ID:
00318457
Vues:
43
Gail,
Some thoughts to consider:
This combo should get repopulated whenever you have new data to display. When you Refresh() the form, the Combo's Refresh is called automatically. That's where the setting of the right choices in the Combo belongs--in the Combo.Refresh().
The Requery has no effect when you are handling the populating through your own code, however, since the purpose of the Requery method is to freshen the Combo's list, that's where your code should go.
So I'm saying whenever you get a new ScanRun->FormChar, you should do a ThisForm.Refresh()
That will cause the Combo.Refresh(). In that method, you call This.Requery(). In the Combo's Requery you put:
This.Clear()
SELECT FormVer, FormVerName ;
   FROM FileConstants ;
   WHERE FormChar = ScanRun.FormChar ;
   INTO CURSOR FormVersions
SCAN
   This.AddListItem(FormVersions.FormVer)
   This.AddListItem(FormVersions.FormVerName, This.NextItemID, 2)
ENDSCAN
USE IN FormVersions
Now get rid of redundant ThisForm.Refresh()s. You only want to refresh the form when you change the underlying data. If you have a control that needs extra help, refresh it individually.


>Newbie question. I have a form on which I would like the user to select from a combo box (sets scanrun->formchar), and the results from that selection to populate a list box (named formverlist) from which another value (formver) can be selected.
>It works, but the list box isn't current until I click on it.
>Which method or methods of which control(s) do I put this code in so that the list box is always filled with the versions of the currently selected formchar in the combo box? Is there a better way? With sincere thanks.
>
>* Table fileconstants has the versions for each formchar.
>* Populate list item of formver list box.
>thisform.formverlist.clear
>select formver,formvername from fileconstants where formchar = scanrun->formchar into cursor formversions
>lni = 1
>scan
> thisform.FORMVERLIST.addlistitem(formversions.formver,lni,1)
> thisform.FORMVERLIST.addlistitem(formversions.formvername,lni,2)
> lni = lni + 1
>endscan
>thisform.refresh
Charlie
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform