Article ID: 157854
Article Last Modified on 6/29/2004
LPARAMETERS tcFileName,tcClass,tcClassLibrary
LOCAL lcFileName,lcLastSetClassLib,oForm
IF EMPTY(tcFileName)
CREATE FORM "" NOWAIT
RETURN
ENDIF
lcFileName=ALLTRIM(tcFileName)
IF NOT "."$lcFileName
lcFileName=lcFileName+".SCX"
ENDIF
lcFileName=FULLPATH(lcFileName)
IF FILE(lcFileName) AND MESSAGEBOX(LOWER(lcFileName)+;
[ already exists.]+CHR(13)+;
[Do you want to replace it?],52+256)#6
RETURN .F.
ENDIF
IF EMPTY(tcClass)
CREATE FORM (lcFileName) NOWAIT
RETURN
ENDIF
IF EMPTY(tcClassLibrary)
oForm=CREATEOBJECT(tcClass)
IF TYPE("oForm")#"O"
RETURN .F.
ENDIF
SET SAFETY OFF && Stop Save As dialog from appearing on next line
oForm.SaveAs(lcFileName)
SET SAFETY ON
IF NOT FILE(lcFileName)
RETURN .F.
ENDIF
MODIFY FORM (lcFileName) NOWAIT
RETURN
ENDIF
lcLastSetClassLib=SET("CLASSLIB")
SET CLASSLIB TO (tcClassLibrary) ADDITIVE
oForm=CREATEOBJECT(tcClass)
IF NOT lcLastSetClassLib==SET("CLASSLIB")
RELEASE CLASSLIB (tcClassLibrary)
ENDIF
IF TYPE("oForm")#"O"
RETURN .F.
ENDIF
SET SAFETY OFF && Stop Save As dialog from appearing on next line
oForm.SaveAs(lcFileName)
SET SAFETY ON
IF NOT FILE(lcFileName)
RETURN .F.
ENDIF
MODIFY FORM (lcFileName) NOWAIT
RETURN
=NewSCX("newform","myform","myvcx")
Keywords: kbhowto KB157854