Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can Setall copy one property to another?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00880459
Message ID:
00880472
Views:
25
This message has been marked as a message which has helped to the initial question of the thread.
John,

The SetAll() method is taking the one value specified in the call and applying that to every object. There is no way to get it to work the way you want without overriding the method. You might want to look at creating your own BroadcastMethodCall to iterate each container and call the method if the object has the MethodName in it's interface. Something like:
thisform.BroadcastMethodCall( "ResetReadOnly" )
where your textbox class has an implementation of ResetReadOnly:
this.ReadOnly = this.lSaveReadOnly
One way to write the iterator method is:
* BroadcastMethodCall()
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
Are you sure you want individual controls to have their own readonly state? You could get your form into a mode where some controls are readonly and others are not, and have a hard time getting them in synch again.

>I have added a lSaveReadOnly property to my textboxes and saved the old value of their ReadOnly property. When the user clicks a button, I want to set their ReadOnly property to the value of their lSaveReadOnly property. I have tried:
>
>thisform.setall("ReadOnly",lsavereadonly,"txtedit")
>and
>thisform.setall("ReadOnly",this.lsavereadonly,"txtedit")
>
>but neither seems to work. The following works:
>
>thisform.setall("ReadOnly",.f.,"txtedit")
>
>but I want to use the value of the lSaveReadOnly property rather than a hard-coded .f.
>
>Can setall be used to access an existing property (i.e., lSaveReadOnly) of the contained objects in the value parameter of the setall method?
df (was a 10 time MVP)

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

Click here to load this message in the networking platform