Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Code to Create SYS Functions Class
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
Code to Create SYS Functions Class
Miscellaneous
Thread ID:
00686301
Message ID:
00686301
Views:
87
You must extract the FOXCODE2.DBF/FPT files from the XSOURCE.ZIP file found in the VFP HOME() + [Tools\XSource] folder. Then run the following code with those 2 files in the same folder. The code is utilitarian and could probably use a little work. What is nice about this is intellisense kicks in with the Parameter list:
CLOSE ALL
CLEAR
IF NOT FILE('FoxCode2.dbf')
   MESSAGEBOX('You must extract FoxCode2.DBF/FPT ';
      + 'from zip file in the ' + HOME() + 'Tools\XSource folder')
   RETURN .f.
ENDIF
IF NOT FILE('SysFuncs.dbf')
   CREATE TABLE SysFuncs ;
      (Key C(5), Key2 C(15), FuncName C(20), ;
       MenuItem C(65), Syntax M, Syntax2 M, MenuTip M)
    APPEND FROM FoxCode2 FOR TRIM(Key) == 'SYS'
ENDIF
CLOSE ALL
USE SYSFuncs
BROWSE LAST NOCAPTIONS FIELDS key2,funcname,menuitem ;
   FREEZE funcname TITLE [Assign Funtion Names]
SET TEXTMERGE TO SysFuncs.PRG noshow
SET TEXTMERGE on
\\*!*   
\*!* Class of all the VFP7 SYS functions with normal function names
\*!*   
\DEFINE CLASS SysFuncs as Custom
\
\   PROCEDURE RELEASE
\      RELEASE THIS
\   ENDPROC
SCAN
   IF EMPTY(SysFuncs.FuncName)
      \   FUNCTION SYSFUNC_<<ALLTRIM(SysFuncs.Key2)>>
   ELSE
      \   FUNCTION <<ALLTRIM(SysFuncs.FuncName)>>
   ENDIF
   AddComments()
   lcPList = []
   *!* SYS(2001, cSETCommand [, 1 | 2])
   *!*   SYS(2022 [, cDiskName])
   *!*   SYS(1269, oObjectName, cProperty, nPropertyAttribute)
   *!*   SYS(3056 [,1])
   IF AT([,], SysFuncs.Syntax2) > 0
      ALINES(laSyntax, SySfuncs.syntax2)
      lcString = laSyntax[1]
      lcComma = []
      lcPList = []
      lnI = 1
      lcParm = STREXTRACT(lcString, [, ], [ ], lnI, 2)
      IF EMPTY(lcParm)
         lcParm = STREXTRACT(lcString, "[,", [ ], lnI, 2)
      ENDIF
      DO WHILE NOT EMPTY(lcParm)
         lcParm = CHRTRAN(lcParm, [ ], [])
         lcParm = CHRTRAN(lcParm, "[", "")
         lcParm = CHRTRAN(lcParm, "]", "")
         lcParm = CHRTRAN(lcParm, ")", "")
         IF AT(lcParm, [|]) > 0
            lcParm = [Parm] + TRANSFORM(lnI)
         ENDIF
         lcPList = lcPList + lcComma + [t] + lcParm
         lcComma = [, ]
         lnI = lnI + 1
         lcParm = STREXTRACT(lcString, [, ], [ ], lnI, 2)
      ENDDO
      lcPList = STRTRAN(lcPList, [,,], [,])
      IF EMPTY(lcPList)
         lcPList = [tuParm1]
      ENDIF
      \      LPARAMETERS <<lcPList>>
   ENDIF
   \      RETURN SYS(<<ALLTRIM(SysFuncs.Key2)>>
   IF NOT EMPTY(lcPList)
      \\, <<lcPList>>
   ENDIF
   \\)
   \   ENDFUNC
ENDSCAN
\
\ENDDEF
SET TEXTMERGE off
SET TEXTMERGE to
MODIFY COMMAND SysFuncs


PROCEDURE AddComments
*
LOCAL lcComments, lcRetVal
lcComments = ALLTRIM(SysFuncs.MenuTip)
IF LEN(lcComments) < 50
   RETURN lcComments
ENDIF
lnSpaces = OCCURS([ ], lcComments)
lcString = [*!*   ] ;
         + ALLTRIM(SUBSTR(lcComments, 1, AT([ ], lcComments))) + [ ]
FOR lnI = 1 TO lnSpaces
   lcString = lcString + STREXTRACT(lcComments, [ ], [ ], lnI, 2) + [ ]
   IF LEN(lcString) > 50
      \      <<lcString>>
      lcString = [*!*   ]
   ENDIF
ENDFOR
IF NOT lcString == [*!*   ]
   \      <<lcString>>
ENDIF
Mark McCasland
Midlothian, TX USA
Next
Reply
Map
View

Click here to load this message in the networking platform