Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Recurse through all controls
Message
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Miscellaneous
Thread ID:
00904798
Message ID:
00905127
Views:
19
Thanks. I'm fortunately developing in 8.0 so I can use the compact solution.

>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.
Cheers,
Jamie
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform