Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
OBJEXIST()
Message
De
31/12/1996 22:00:28
 
 
À
28/12/1996 04:44:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00016055
Message ID:
00016271
Vues:
51
So herein lies the answer. Create a method (lets say OBJEXIST()). The method aquires a control count on the form. Then using the number of controls, creates a loop with a DO CASE structure in its interior. The case structure tests for the BASECLASS of the controls. IF a CASE of command button exists, test its SUBSTR(object.Name,7) for "cmdNEXT". Then if such a button exists disable it. With this process encapsulation is not violated, the commandbutton maintains maximum independence, it may also be placed in a container with other objects, and this enables maximum reutilization of code. The code here is of course invoked from an appropriate test for EOF().

For lncount = 1 to ThisForm.ControlCount
DO CASE
CASE ThisForm.Controls(lncount).BaseClass = "CommandButton"
ThisForm.Controls(lncount).Enabled = IIF(SubStr(ThisForm.Controls(lncount).Name,7)= "cmdNEXT",.F.,.T.)
CASE .....
EndCase

Of course this.code can and should be extended to other objects, and it can be extended to check additional containers in a form.
Terry Rooks
Software Systems Architect
Microsoft Certified Solution Developer.Net

If at first you don't succeed, then skydiving definitely isn't for you.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform