Wiki Home

Text Merge Class


Namespace: VFP
A class for managing textmerge to multiple files.
**************************************************
*-- Class:        textmerge (d:\rns\code\common\classes\pdswizard.vcx)
*-- ParentClass:  rnscustom (d:\rns\code\common\classes\rnsbase.vcx)
*-- BaseClass:    custom
*-- Time Stamp:   05/20/99 01:44:03 PM
*
DEFINE CLASS textmerge AS custom
	filename = ""
	oldtextmerge = ""
	old_text = ""
	filehandle = 0
	*-- Contains the merged text.
	mergedtext = ""
	Name = "textmerge"
	istemp = .F.

	*-- Occurs when a FormSet, Form, or Page object becomes active or when a ToolBar object is shown.
	PROCEDURE activate
		*  05-Apr-99 4:11:40 PM jMM
		this.old_Text = _text
		_text = this.fileHandle

		set textmerge on 
		set textmerge noshow
	ENDPROC


	PROCEDURE mergedtext_access
		*  05-Apr-99 4:11:38 PM jMM
		local lcRetVal
		fclose( this.fileHandle )
		_text = -1
		lcRetVal = filetostr( this.fileName )
		this.fileHandle = fopen( this.fileName )
		_text = this.fileHandle

		return lcRetVal
	ENDPROC


	PROCEDURE filename_assign
		*  05-Apr-99 4:11:35 PM jMM
		lparameters tcFileName
		if empty( tcFileName )
			this.fileName = sys(3) + '.tmp'
			this.isTemp = .t.
		else
			this.fileName = tcFileName
			this.isTemp = .f.
		endif

		fclose( this.fileHandle )
		this.fileHandle = fcreate( this.fileName )
		this.activate()
	ENDPROC


	*-- Occurs when a container object, such as a form,
	*-- is no longer active because none of its contained objects has the focus.
	PROCEDURE deactivate
		*  05-Apr-99 4:11:29 PM jMM
		_text = this.old_Text
	ENDPROC


	PROCEDURE Init
		*  05-Apr-99 4:11:31 PM jMM
		this.oldTextMerge = set( 'textmerge' )
	ENDPROC


	PROCEDURE Destroy
		*  05-Apr-99 4:11:33 PM jMM
		local lcOldTextMerge
		lcOldTextMerge = this.oldTextMerge
		set textmerge &lcOldTextMerge
		fclose( this.fileHandle )
		_text = this.old_Text
		if this.isTemp
			erase ( this.fileName )
		endif
	ENDPROC


ENDDEFINE
*
*-- EndDefine: textmerge
**************************************************

Category Code Samples
( Topic last updated: 2000.03.14 11:06:50 AM )