Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to determine all the places a class has been used
Message
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Miscellaneous
Thread ID:
00271783
Message ID:
00271835
Views:
22
>How do I determine all of the places in a project where a class has been used. In particular some Wizstyle classes have infiltrated my project and I am having difficultly finding what is using them.

Searh for a string within .scx and .vcx?
Like: (quick and dirty)
* Example: Do SearchForClass with 'wizards'
*          (locate every reference to class within wizards directory)
PROCEDURE SearchForClass
LParam pcClass
If Type('pcClass')!= 'C' .or. Empty(pcClass)
    ? 'Missing parameter: string to search for in Classes and Forms.'
    Return
Endif

Local laFilelist(1), lcFilename, j, lcfmask, lcFilename

*- Get a list of all forms in current directory
lcfmask = '*.scx'

Do While .t.
   =Adir(laFilelist, lcfmask)
   Select 0

   If Type("laFilelist(1)") == "C"
      For j=1 To Alen(laFilelist,1)
         lcFilename = laFilelist(j,1)
         Use (lcFileName) Alias FAlias Exclusive

         *- Search within the class filename
         Locate All For !Empty(FAlias.Classloc) .And. Atc(pcClass, FAlias.ClassLoc)>0
         Do While !Eof()
            ? 'File: ' + lcFilename+', ', ;
              'ObjectName:' + FAlias.ObjName+', ', ;
              'ObjectClass:' + FAlias.Class
            Continue
         EndDo
      EndFor
   Endif

   Use

   If lcfmask = '*.scx'
      Release laFilelist
      Dimension laFilelist(1)
      *- Get a list of all class in current directory
      lcfmask = '*.vcx'
   Else
      Exit
   Endif
EndDo

EndProc

Just an opinion... Not a fact.
Previous
Reply
Map
View

Click here to load this message in the networking platform