Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Can SetAllX be used to call a method of a particular cla
Message
From
06/08/2007 07:02:18
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
06/08/2007 02:30:53
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01245942
Message ID:
01246108
Views:
30
>>Hi all
>>
>>I wanted to loop through all controls on a form and if an instance of a particular class is found I wanted a method of this class to be executed, can SetAllX do this?
>>
>>Further, this called method will return a logical value depending on which I want the calling code to stop further processing, so out of multiple instances even if one of them returns a .F. I want the calling code to stop executing. So is it possible to get a list of return values from SetAllX?
>>
>>Please advise.
>
>Hi Bhav
>
>Here is generic solution I use for this kind of things;
>
>Create custom object class in some of your common VCX libraries
>out of this code
>
>
>define class FormScanner as custom
>
>    procedure ScanControls
>        lparameters oParentContainer
>        local i,oControl
>        for each oControl in oParentContainer.controls
>            do case
>                case oControl.baseclass="Pageframe"
>                    for i = 1 to  oControl.pagecount
>                        this.ScanControls(oControl.pages(i))
>                    next
>
>                case oControl.baseclass="Container"
>                    this.ScanControls(oControl)
>
>                case oControl.baseclass="Grid"
>                    for i = 1 to  oControl.columncount
>                        this.ScanControls(oControl.columns(i))
>                    next
>                otherwise
>                    this.with_object(oControl)
>            endcase
>        endfor
>        this.with_object(oParentContainer)
>
>
>    procedure with_object
>        lparameters oControl
>        wait wind oControl.name timeout 0.5
>
>enddefine
>
>
>
>Then simply drop that class object to form you want to scan
>and use 'With_Object' hook method to do whatever you want with that particular control. This method will receive all form controls wherever
>they are as object reference parameter.
>
>To run whole thing simply call loop method of custom obect scanner
>as
>
>
>thisform.FormScanner1.ScanControls(thisform)
>
>*Or any other containership
>
>thisform.FormScanner1.ScanControls(thisform.myPageFrame1)
>
>thisform.FormScanner1.ScanControls(thisform.myContainer1)
>
>*etc
>
>
>
>HTH

Srdjan,
I'm sorry but it's not generic. It's limited to part of controls that can be used in VFP.
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform