The problem with hacking the form is that there is no guarantee the method you 
want is in the Methods column. It will
only be there if there is code already in the method.

I would recommend a builder in this case. You would have to open each form and 
right-click, Builder to make it happen,
but it would be faster than manually going through the steps. Here is some 
sample code I did for something similar to
what you want to accomplish. You certainly could use the ReadMethod() to get 
the existing code, tack on your doc to the
beginning and write it out with the WriteMethod(). To register the builder, run 
the SelfRegister() method.



LPARAMETERS tuParameter, tuTwo, tuThree, tuFour, tuFive, ;
            tuSix, tuSeven, tuEight, tuNine

IF VARTYPE(tuParameter) = "L" AND tuParameter = .T.
   SelfRegister()
   RETURN
ENDIF

* Get a reference to the selected object
DIMENSION laObjects[1]
laObjects[1] = .F.

ASELOBJ(laObjects, 1)

IF VARTYPE(laObjects[1]) # "L"
   * Check that the class or form being run into the builder
   * is the outer most class or form, and not an object 
   * inside a container object. This builder can be run on
   * a command button in the class designer, but not on a
   * command button on a form in the form designer.
   lcTopWindow = LOWER(WONTOP())

   DO CASE
      CASE ".scx" $ lcTopWindow AND LOWER(laObjects[1].BaseClass) = "form"
         UpdateDocumentation(laObjects[1])
      CASE ".vcx" $ lcTopWindow AND LOWER(laObjects[1].Name) $ lcTopWindow
         UpdateDocumentation(laObjects[1])
      OTHERWISE
         * No outer most object selected for builder to run
         MESSAGEBOX("The object selected was not outer most container or class, 
which this builder is designed to work
with.", 0 + 16, _screen.Caption)
   ENDCASE
ELSE
   MESSAGEBOX("You ran the builder without selecting an object to build.", 0 + 
16, _screen.Caption)
ENDIF

RETURN .T.


***************************************
FUNCTION UpdateDocumentation(toObject)
***************************************

LOCAL lcDocMethod, ;
      lcExistingMethodCode

lcDocMethod          = "zzAbout"
lcExistingMethodCode = SPACE(0)

IF PEMSTATUS(toObject, lcDocMethod, 5)
   lcExistingMethodCode = toObject.ReadMethod(lcDocMethod)
ENDIF

IF EMPTY(lcExistingMethodCode)
SET TEXTMERGE OFF
TEXT TO lcNewMethodCode NOSHOW
****************************************************************************
*
*  CLASS NAME: <<toObject.Name>>
*
*  AUTHOR: Richard A. Schummer, <<CMONTH(DATE())>> <<YEAR(DATE())>>
*
*  COPYRIGHT C <<YEAR(DATE())>>  All Rights Reserved.
*     Richard A. Schummer
*     White Light Computing, Inc.
*     42759 Flis Dr.
*     Sterling Heights,  MI  48314
*
*     [email protected]
*     http://whitelightcomputing.com
*     [email protected]
*     http://rickschummer.com
*
*  SYSTEM: 
*
*  PROGRAM DESCRIPTION: 
*     This <<LOWER(toObject.BaseClass)>>
*
*  CALLED BY: 
*     
*
*  INPUT PARAMETERS:
*     None
*
*  OUTPUT PARAMETERS:
*     None
* 
*  DATABASES ACCESSED: 
*     None
* 
*  DEVELOPMENT STANDARDS:
*     Version 4.0 compliant
*  
*  TEST INFORMATION:
*     None
*   
*  SPECIAL REQUIREMENTS/DEVICES:
*     None
*
*  FUTURE ENHANCEMENTS:
*     None
*
*  LANGUAGE/VERSION:
*     Visual FoxPro <<VERSION(4)>> or higher
* 
****************************************************************************
*
*                           C H A N G E    L O G                            
*
*   Date      Dev  Version  Description
* ----------  ---  -------  ------------------------------------------------
* <<DATE()>>  RAS  1.0      Created tool
* --------------------------------------------------------------------------
*
****************************************************************************

#IF .F.
#ENDIF
ENDTEXT

toObject.WriteMethod(lcDocMethod, TEXTMERGE(lcNewMethodCode), .T.)
ENDIF

ENDFUNC


***********************
FUNCTION SelfRegister()
***********************

LOCAL lnOldSelect, ;
      lcBuilderName

lnOldSelect   = SELECT()
lcBuilderName = "WLC Object Builder (Doc Header)"

USE (HOME()+"Wizards\Builder.dbf") AGAIN SHARED ALIAS curRegBuilder IN 0
SELECT curRegBuilder

LOCATE FOR Name = lcBuilderName

IF FOUND()
   * Already registered
   MESSAGEBOX(lcBuilderName + " was already registered with Visual FoxPro v" + 
VERSION(4), ;
              0+64, lcBuilderName)
ELSE
   SCATTER MEMVAR MEMO BLANK

   m.Name      = lcBuilderName
   m.Descript  = "Applies documentation to a zzReadMe, zzAbout, or other 
specified method to the outer most container
object in the designer."
   m.Type      = "ALL"
   m.Program   = SYS(16, 0)

   INSERT INTO curRegBuilder FROM MEMVAR

   MESSAGEBOX(lcBuilderName + " has been registered with Visual FoxPro v" + 
VERSION(4), ;
              0+64, lcBuilderName)
ENDIF

USE IN (SELECT("curRegBuilder"))
RETURN

ENDFUNC

*: EOF :*





Rick
White Light Computing, Inc.

www.whitelightcomputing.com
www.swfox.net
www.rickschummer.com


-----Original Message-----
From: [email protected] [mailto:[email protected]] On 
Behalf Of MB Software Solutions, LLC
Sent: Friday, August 05, 2011 04:30
To: [email protected]
Subject: Re: Copyright for vfp code

On 8/5/2011 4:19 PM, Jerry Foote wrote:
> Figure out how you want it to appear, then use the scx and see what it 
> looks like in in the form code.
> Then scan thru your project hack each screen in the project to add the 
> necessary code.


Not sure if Rick Schummer's HackCX would be intended for this kind of 
thing?   (Rick?)


--
Mike Babcock, MCP
MB Software Solutions, LLC
President, Chief Software Architect
http://mbsoftwaresolutions.com
http://fabmate.com
http://twitter.com/mbabcock16

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to