Files
vfp_roaauto/COMUN/programe/obj2arr.PRG

101 lines
2.3 KiB
Plaintext

* Version....: 1.0
* Author.....: Maurice de Beijer
* Date.......: January 29, 1998
* Notice.....: Copyright (c) 1996-1998 ABL, All Rights Reserved.
* Compiler...: Visual FoxPro 05.00.00.0415 for Windows
* Abstract...: Creates a one dimensional array with a pointer
* to all object contained within the object
*
* Returns....: The number of selected objects
*
* Parameters.: taTarget
* Target array (passed by reference)
* taObject
* Container object reference
*
LPARAMETERS taTarget, taObject
LOCAL lnCount
lnCount = 0
DIMENSION taTarget[1, 1]
taTarget = NULL
*
* Make sure an object was passed
*
IF TYPE('taObject') = 'O' AND !ISNULL(taObject)
*
* Object passed into recursive call
*
object2array(@taTarget, taObject)
IF TYPE('taTarget[1]') = 'O'
*
* Retun the number of objects
*
lnCount = ALEN(taTarget, 1)
ENDIF
ENDIF
RETURN lnCount
*-------------------------------------------------------
* Function....: Object2Array
* Called by...: Obj2Arr
*
* Abstract....: Creates a one dimensional array with a pointer
* to all object contained within the object
*
* Returns.....: None
*
* Parameters..: taTarget
* Target array (passed by reference)
* taObject
* Container object reference
*
* Notes.......:
*-------------------------------------------------------
PROCEDURE Object2Array(taTarget, taObject)
LOCAL ARRAY laMembers[1, 1]
LOCAL lnCount, lnI
*
* Make sure the second parameter is an object before adding it to the array
*
IF TYPE('taObject') = 'O' AND !ISNULL(taObject)
IF TYPE('taTarget[1]') = 'O' AND !ISNULL(taTarget[1])
*
* Increase the array size
*
lnCount = ALEN(taTarget, 1) + 1
DIMENSION taTarget[lnCount]
*
* Add the current object to the end
*
taTarget[lnCount] = taObject
ELSE
*
* First object in the array
*
taTarget[1] = taObject
ENDIF
*
* Get all member names
*
lnCount = AMEMBERS(laMembers, taObject, 2)
FOR lnI = 1 TO lnCount
*
* Get all contained objects from the member objects
*
object2array(@taTarget, EVAL('taObject.' + laMembers[lnI]) )
ENDFOR
ENDIF
RETURN