Article ID: 183296
Article Last Modified on 5/10/2003
*-- Code begins here.
CLEAR
oX = CREATEOBJECT("Container")
FOR counter = 1 TO 30
oX.ADDOBJECT("x"+LTRIM(STR(counter)), "Example")
ENDFOR
=SetAllProp("MyProperty", "", "oX")
=SetAllProp("MyProperty", "Example One - Test", "oX")
? oX.CONTROLS[1].MyProperty
? oX.CONTROLS[2].MyProperty
? oX.CONTROLS[3].MyProperty
? oX.CONTROLS[30].MyProperty
? && Separator
? && Separator
*-- PROCEDURE SetAllProp
*-- Step through the objects in a container and set the passed property
*-- for each object.
*-- Parameters: lcProperty - The property to change.
*-- lcValue - The property's value.
*-- lcContainer - The container containing the objects whose
*-- properties are to be changed.
PROCEDURE SetAllProp()
PARAMETERS lcProperty, lcValue, lcContainer
*-- Load the object names into an array.
=AMEMBERS(laObjects, EVALUATE(lcContainer), 2)
*-- Step through the array and change the passed property for each
*-- object.
FOR liCounter = 1 TO ALEN(laObjects)
lcCommand = lcContainer + "." + laObjects(liCounter) + "." + ;
lcProperty + "=" + "'" + lcValue + "'"
&lcCommand
ENDFOR
ENDPROC
DEFINE CLASS Example AS CUSTOM
MyProperty = "Initial MyProperty"
ENDDEFINE
*-- Code ends here.
*-- Code begins here.
CLEAR
oX = CREATEOBJECT("Container")
FOR counter = 1 TO 30
oX.ADDOBJECT("x"+LTRIM(STR(counter)), "Example")
ENDFOR
*-- Round 1
*-- Comment the following line and the properties are not corrupted.
oX.SETALL("MyProperty", "")
oX.SETALL("MyProperty", "Example One - Test")
? oX.CONTROLS[1].MyProperty
? oX.CONTROLS[2].MyProperty
? oX.CONTROLS[3].MyProperty
? oX.CONTROLS[30].MyProperty
? && Separator
? && Separator
*-- Round 2
*-- Uncommenting the following line just gives different corruption:
*oX.SETALL("MyProperty", "")
oX.SETALL("MyProperty", "Sample")
oX.SETALL("MyProperty", "Sample2")
oX.SETALL("MyProperty", "Sample3")
oX.SETALL("MyProperty", "Example Two")
? oX.CONTROLS[1].MyProperty
? oX.CONTROLS[2].MyProperty
? oX.CONTROLS[3].MyProperty
? oX.CONTROLS[30].MyProperty
DEFINE CLASS Example AS CUSTOM
*-- Doesn't matter what the property is initially set to.
MyProperty = "Initial MyProperty"
ENDDEFINE
*-- Code ends here
Additional query words: GPF crash hang kbvfp600fix
Keywords: kbbug kbfix kbcode KB183296