James Bott wrote:A TDataSource class could be a parent class of these various types of classes that is never actually instantiated by itself, but rather just used as an inheritance source. I have seen this done before.
James Bott wrote:Enrico,
According to the book, "Business Engineering with Object Technology," by David A. Taylor, P 91, classes that never get instantiated themselves are called "abstract" classes. If they are instantiated themselves, then they are called "concrete" classes.
Perhaps they are also called "interface" classes.
James
CLASS TDataSource
DATA lAutoEdit INIT .F.
METHOD New() INLINE Self
METHOD GoTop() VIRTUAL
METHOD GoBottom() VIRTUAL
METHOD Skip( nRecords ) VIRTUAL
METHOD Get() VIRTUAL
METHOD Set() VIRTUAL
METHOD Count() VIRTUAL
METHOD GetPos() VIRTUAL // equivalent for RecNo()
METHOD SetPos( nPos ) VIRTUAL // equivalent for GoTo()
METHOD Edit() // Automatically build an editing interface
METHOD OnDataChange() VIRTUAL
ENDCLASS
METHOD SetXBrowse( oBrw, aCols, lAutoSort, lAutoCols ) CLASS TArray // (your class name)
local aHead, n, nAt
if aCols == nil
lAutoCols := .t.
aHead := ArrTranspose( ::aStruct )[ 1 ]
aCols := .t.
else
lAutoCols := .f.
aHead := AClone( aCols )
for n := 1 to Len( aCols )
aCols[ n ] := Max( 1, AScan( ::aStruct, { |a| Upper( aCols[ n ] ) == Upper( a[ 1 ] ) } ) )
next n
endif
WITH OBJECT oBrw
:SetArray( ::aData, lAutoSort, 1, aCols )
:cHeaders := aHead
for n := 1 to Len( :aCols )
WITH OBJECT :aCols[ n ]
:cDataType := ::aStruct[ n, 2 ]
:nDataLen := ::aStruct[ n, 3 ]
:nDataDec := ::aStruct[ n, 4 ]
if ::cDataType == 'N'
:cEditPicture := NumPict( :nDataLen, :nDataDec )
endif
END
next
END
return oBrw
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 96 guests