Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Counting objects
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00546396
Message ID:
00546401
Vues:
14
This message has been marked as a message which has helped to the initial question of the thread.
>Is there a way programmatically to know how many objects are open on a form?
>
>I have a form with six check boxes on it, and as they're named "Check1", "Check2", etc., I run a loop to pull their values for further processing.
>
>In the near future, we'll add about four more checks, and an unknown number after that. Currently, all I have to do is add the new object and change the parameters of the loop, but I'd like to be able to simply add the object and let the program do the counting.
>
>Is there a way to determine within the program how many objects named "Check" are on the form and run the loop dynamically?

How's this:
LOCAL lncount
lncount = 0
FOR EACH oObj IN ThisForm.Objects
  IF oObj.BaseClass = "Checkbox"
    lncount = lncount + 1
  ENDIF 
NEXT
The lncount variable will contain the number of check boxes. There may, however, be a problem with this approach if the check boxes are part of a container class.


>In a similar vein, is it possible to add check boxes dynamically based on data in a table?

Sure, look at AddObject()
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform