Article ID: 192578
Article Last Modified on 7/1/2004
CREATE CLASS ProjHook AS ProjectHook of myProjHook
LPARAMETERS fName
fExt = RIGHT(fName,3)
DO CASE
CASE fExt = "prg"
MODIFY COMMAND fName
CASE fExt = "scx"
MODIFY SCREEN fName
CASE fExt = "frx"
MODIFY REPORT fName
CASE fExt = "vcx"
MODIFY CLASS fName
CASE fExt = "dbc"
MODIFY DATABASE fName
CASE fExt = "dbf"
MODIFY STRUCTURE fName
OTHERWISE
MESSAGEBOX("Unable to Edit File")
ENDCASE
This method uses a MODIFY command specific to the file type passed to
it.
Wait window "Loading ProjectHook Class............" TIMEOUT 1
This method is invoked when the Project Designer is opened.
LPARAMETERS oFile, cClassName, lDeleteFile
msgsel = MESSAGEBOX("Would You like to Edit the File",4)
IF msgsel = 6
THIS.fModify(oFile.Name)
ENDIF
msgsel = MESSAGEBOX("Remove file (Y/N): ",4)
IF msgsel = 7
NODEFAULT
ELSE
WAIT WINDOW "Removing File......." TIMEOUT 1
ENDIF
The preceding code runs every time a file is removed from the Project
Manager.
LPARAMETERS oFile
MSGSEL = MESSAGEBOX("Would You like to Edit the File",4)
IF MSGSEL = 6
THIS.FMODIFY(oFile.NAME)
ENDIF
WAIT WINDOW "Now Running the File....." TIMEOUT 1
The preceding code executes whenever a file is run from the Project
Manager.
LPARAMETERS nError, cMethod, nLine
errmsg = MESSAGE(nError)
MESSAGEBOX("Error #: "+ALLTRIM(STR(nError))+CHR(13)+;
"Error Msg: "+errmsg+CHR(13)+;
"In Method: "+cMethod+CHR(13)+;
"At Line: "+ALLTRIM(STR(nLine)))
The preceding code executes whenever there is a run-time error in a
method.
Visual FoxPro Help; search on: Project Manager Hooks
Additional query words: kbVFp600 kbProjManager
Keywords: kbhowto kbcode KB192578