extractmethod Method
Object: frmbehindsc
Expand/Collapse source code of procedure extractmethod Source Code
LPARAMETER tnFileHandle, tcMethod

LOCAL lnMemoLength, ;
      lnMethStartPos, ;
      lcMethod, ;
      lnLine, ;
      lcOutputString

lnMemoLength = LEN(showmeth.methods)
lnMethStartPos = ATC("PROCEDURE " + tcMethod, showmeth.methods)

IF lnMethStartPos = 0
  lcMethod = TAB + tcMethod + " not found in " + DBF()
  RETURN
ELSE
  lnMethEndPos = ATC(CRLF + "ENDPROC" , SUBSTR(showmeth.methods, lnMethStartPos))

  IF lnMethEndPos = 0   && Last proc in Method Memo
    lnMethEndPos = lnMemoLength - lnMethStartPos
  ENDIF

  lcMethod = SUBSTR(showmeth.methods, lnMethStartPos, lnMethEndPos)
ENDIF

FOR lnLine = 1 TO MEMLINES(lcMethod)
  lcOutputString = ""
  IF BETWEEN(lnLine, 1, MEMLINES(lcMethod))
    lcOutputString = TAB
  ENDIF

  =FPUTS(tnFileHandle, lcOutputString + MLINE(lcMethod, lnLine))
ENDFOR

=FPUTS(tnFileHandle, CRLF)