Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Running specific method of many objects
Message
 
 
To
15/04/2004 10:33:42
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00895140
Message ID:
00895411
Views:
29
This message has been marked as a message which has helped to the initial question of the thread.
Claudio,

It's pretty easy to implement this feature yourself. I put this code in the lowest level cObject class that is the ulitmate ParentClass of things like BizObjs etc:
* BroadcastMethodCall method
lparameter pcMethod

local loObject, llRetVal, lcObjectMethod

llRetVal = .T.

lcObjectMethod = "loObject." + pcMethod + "()"

for each loObject in this.objects
   * Propogate method call to the contained objects

   if PEMStatus( loObject, pcMethod, 5 )
      * that have this method
      llRetVal = llRetVal and eval( lcObjectMethod )
   endif

   if ( llRetVal and PEMStatus( loObject, "BroadcastMethodCall", 5 ) )
      * recurse into the contained object
      llRetVal = loObject.BroadcastMethodCall( pcMethod )
   endif

   if ( ! llRetVal )
      * stop on the first object that doesn't return .t.
      exit
   endif
endfor

return llRetVal
the usage is like:

this.BroadcastMethodCall( "Use" )

which would let every contained object USE the tables they need.

The code checks to see if the contained objects actually have the method in their interface, and then recursively call the object's BroadcastMethodCall() if it has that interface.

I decided to to always make these methods parameterless to simplify the propogation. Each object just uses it's property values to determine it's own relevant "parameters" for the operation it is wanting to accomplish.

>SetAll sets a property of same based class objects.. It does not matter how many are in our form..
>
>Is there a way to run a specific method of same based class objects ? Something compared to setall for methods..
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform