Wiki Home

_ Com Component Example 11


Namespace: People
define class cPerson as custom olepublic

	FirstName = space(10)
	LastName = space(10)
	cVersion = "1.1"

        procedure Init
             IF INLIST(_VFP.StartMode,2,3)
                 SYS(2335,0)
             ENDIF

             This.RefreshData()
        endproc

	procedure OpenData
		if not used("Person")
                        SELECT 0
			use Person Again
                else
                        select person
		endif
                RETURN USED("person")
	endproc

	procedure Destroy
                if used('person')
                    use in Person
                endif
	endproc

	procedure RefreshData
             IF This.OpenData()
		this.FirstName = Person.FirstName
		this.LastName = Person.LastName
             ENDIF
	endproc

	procedure GoNext
                IF This.OpenData()
                    select Person
   		    if not eof()
			skip 1
			if eof()
			    skip -1
			endif
 		    endif
		    this.RefreshData
                ENDIF
	endproc

	procedure GoPrev
                IF This.OpenData()
		    select Person
		    if not bof()
			skip -1
		    endif
		    this.RefreshData
                ENDIF
	endproc

	function FindInName( tcSubName )
            IF This.OpenData()  
		select Person
		locate for upper( tcSubName ) $ upper( FirstName + LastName )
		this.RefreshData
		return found()
            ENDIF
	endproc

	function FullName
		return trim( this.FirstName - ( " " + this.LastName ) )
	endproc

enddefine
( Topic last updated: 2000.10.18 08:48:26 PM )