Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Finding All Textboxes in Form
Message
De
05/09/2005 06:25:38
 
 
À
01/09/2005 14:40:52
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Versions des environnements
Visual FoxPro:
VFP 6
Divers
Thread ID:
01045035
Message ID:
01046746
Vues:
34
Hi Dragan,
Since we did more less the same thing more less the same way, I propose
we dare for more - together:)

Here is basic code/idea how to drill down ALL objects starting with VFP
application object if requested, and then access everything within.
So let's see what (else) can be done with it.

Difference in aproach is that i/o calling it via procs/funcs
user will simply subclass it and write it's own object handling
in special kind of listener method 'with_object' that gets EACH scanned object passed as parameter letting him do whatever he/she wants with it.

I used similar aproach with XDIR tool for scanning directory structures
and I kind of liked it :)

Just copy this code in a new prg and try it.
It shld work right away showing names of all object found within _vfp
object.
local oGPRO
oGPRO=createobject('ObjectScanner')
oGPRO.scan_vfp()

*oGPRO.scan_containtership(oFormReference)   &&valid call for 
*downsizing scan scope to a single containership.


***App GPRO
define class ObjectScanner as shape

    procedure scan_vfp
        local i,oObj
        i=1
        do while type('_vfp.objects(i)') <> 'U'
            oObj=_vfp.objects(i)
            do case
                case inlist(oObj.baseclass,'Form','Container','Toolbar')
                    this.scan_containership(oObj)

                *Case it is formset do we bother 
                *handling  that ?                 

                *Case it is collection then what ?   (I am with VFP6)
                
                *Anything else like accessing all session objects ?

                otherwise
                    this.with_object(oObj)

            endcase
            i=i+1
        enddo


    procedure scan_containership
        lparameters oParentContainer
        local i,oControl
        for each oControl in oParentContainer.controls
            do case
                case oControl.baseclass=="Pageframe"
                    for i = 1 to  oControl.pagecount
                        this.scan_containership(oControl.pages(i))
                    next

                case oControl.baseclass=="Container"
                    this.scan_containership(oControl)

                case oControl.baseclass=="Grid"
                    for i = 1 to  oControl.columncount
                        this.scan_containership(oControl.columns(i))
                    next
                otherwise
                    this.with_object(oControl)
            endcase
        next
        this.with_object(oParentContainer)


    procedure with_object  && Listener method
        lparameters oObject
        wait wind 'Scanning object [' + oObject.name + ']' timeout 0.5


enddefine
Lets see where we can take it from here :)
If we come up with something usefull , then we can post it together
here on UT, or just add it to yr existing download.

Rgds++
Sergio



>>>You can curse at this all you want, but you can re-curse as well. Download #21923.
>>
>>Hi Dragan,
>>I recursed it myself :)
>>See Message#1045044 in this thread. It is also general purpose recursion
>>class but only within single form. I did not subclass it in my message for simplicity purposes.
>>
>>Will however take good look at yr GPR class
>>to see what else is there :)
>
>Probably not much. I tried to keep it fat-free, no salad.
>
>Maybe the example may give you some ideas.
*****************
Srdjan Djordjevic
Limassol, Cyprus

Free Reporting Framework for VFP9 ;
www.Report-Sculptor.Com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform