Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OBJEXIST()
Message
From
31/12/1996 22:00:28
 
 
To
28/12/1996 04:44:04
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
00016055
Message ID:
00016271
Views:
39
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.
Previous
Reply
Map
View

Click here to load this message in the networking platform