Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recurse through all controls
Message
From
18/05/2004 16:15:28
 
 
To
18/05/2004 07:28:14
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00904798
Message ID:
00905088
Views:
14
I like Tamar's approuch. But I beleive prior to 8.0 not all controls that allowed child objects had a Objects collection. When I was developing the Locale class (found in the download section), I constructed the following to work around this pitfall.

It walks down the PEM looking for any Object, or Property that contains an object.
*-- Called from within a Form
RecurAllObj( THISFORM )

*-- Place this routine some global.
PROCEDURE RecurAllObj
    LPARAMETER toObj

    LOCAL k, j, oObj
    LOCAL ARRAY aMems[1,3]
    k = AMEMBERS( aMems, toObj, 1 )
    FOR j=1 TO k

        *--------------------------------------------
        *  get next control on this container
        *--------------------------------------------
        DO CASE
            CASE INLIST(LOWER(aMems[j,1]), "parent")
            CASE TYPE("toObj."+aMems[j,1])#"O"
            CASE ISNULL(EVALUATE("toObj."+aMems[j,1]))
            OTHERWISE
                *--------------------------------------------
                *  If the Property is  Object, check for text to translate.
                *--------------------------------------------
                oObj = EVALUATE("toObj."+aMems[j,1])
                IF VARTYPE(oObj)="O"

                    *--------------------------------------------
                    *  Transverse to check for controls on this control.
                    *--------------------------------------------
                    IF NOT COMPOBJ( oObj, toObj )
                        RecurAllObj( oObj )
                    ENDIF
                ENDIF

        ENDCASE
    NEXT

    RETURN
ENDPROC
I removed some Locale dependent code to simplify the example.
Greg Reichert
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform