Friends
Have function for create DATAfields
function TMyMSQuery( cCls ) ; return( MyGenClass( cCls, TMSQuery() ) )
The variable __aHCls
AAdd( __aHCls, { cClsName, __nClassH } )
the class and handle
How free
static __aHCls := {}
#include "HbClass.ch"
//---------------------------------------------------------------------------//
// Generador de clases dinamicas
function MyGenClass( cClsName, FromClass )
local n, __nClassH, __odB
local cFromClass := upper( FromClass:ClassName() )
cClsName := "TMY" + Upper( if( empty( cClsName ), ;
PadL( len( __aHCls ), 7, "0" ), Alltrim( cClsName ) ) )
if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
_HB_CLASS cClsName
__oDb := HBClass():New( cClsName, { cFromClass } )
__oDb:Create()
__nClassH := __oDb:hClass
AAdd( __aHCls, { cClsName, __nClassH } )
else
__nClassH := __aHCls[ n, 2 ]
endif
return( __clsInst( __nClassH ) )
//Cretae the function for deleted __aHCls the handling
//the class
Function CloseClass( oClase )
Local n,cClsName
cClsName := "TMY" + Upper( PadL( len( __aHCls ), 7, "0" ) )
if ( n := AScan( __aHCls, { |aClass| aClass[ 1 ] == cClsName } ) ) == 0
// ya se creo la clase
else
__aHCls[ n, 1 ]:=NIL
__aHCls[ n, 2 ]:=NIL
ADEL( __aHCls , n )
endif
oClase:=NIL
return( cClsName )