Hola
Se puede sobreescribir un metodo de una clase con las nueva extensiones de xharbour ?
Por ejemplo quiero modificar el metodo paint de la clase timage
Un saludo
function main(...)
...
/*sobreescritura y extencion de metodos*/
OverrideAndExtend()
...
return nil
PROCEDURE OverrideAndExtend()
OVERRIDE METHOD DispBegin IN CLASS TWindow WITH KDispBegin
OVERRIDE METHOD DispEnd IN CLASS TWindow WITH KDispEnd
EXTEND CLASS TFOLDER WITH METHOD RefreshPages
EXTEND CLASS TFOLDER WITH METHOD GoFirstControl
EXTEND CLASS TDIALOG WITH METHOD RefreshDialog
EXTEND CLASS TPRINTER WITH METHOD Cm2Pix
RETURN
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION KDispBegin()
LOCAL SELF := HB_QSelf()
RETURN SELF
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION KDispEnd()
LOCAL SELF := HB_QSelf()
RETURN NIL
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION RefreshDialog( nPos )
LOCAl Self := HB_QSelf()
aeval( ::aControls, { |oCtrl| oCtrl:Refresh() } )
::aControls[ nPos ]:SetFocus()
RETURN NIL
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION RefreshPages()
LOCAl Self := HB_QSelf()
LOCAL oPage
FOR EACH oPage IN ::aDialogs
aeval( oPage:aControls, { |oCtrl| oCtrl:Refresh() } )
NEXT
RETURN NIL
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION GoFirstControl()
LOCAL SELF := HB_QSelf()
::aDialogs[1]:aControls[1]:SetFocus()
RETURN NIL
/*----------------------------------------------------------------------------------*/
STATIC FUNCTION Cm2Pix(nCm)
LOCAL SELF := HB_QSelf()
IF ValType( ::nXOffset ) == "U"
::nXoffset := 0
ENDIF
nPix := Max( 0, ( nCm * 10 * ::nHorzRes() / ::nHorzSize() ) - ::nXoffset )
RETURN nPix
/*----------------------------------------------------------------------------------*/
CLASS TXBrowse FROM TControl
DATA oVScroll,; // Vertical scrollbar (used internally)
oHScroll,; // Horizontal scrollbar (used internally)
oCapCol,; // Actual mouse captured column (used internally)
oSeek,; // Optional TSay control to display the value of current ::cSeek value
oDbf // Just a container for a DBF object for your own use (it is not used by the class)
oMiObjeto // Data de un objeto que debo agregar
CLASS MiTXBrowse FROM TXBrowse // Definicion de mi clase especializada
DATA oMiObjeto // Mi data
METHOD new() CONSTRUCTOR
ENDCLASS
METHOD new() CLASS MiTXBrowse
::super:New() // Ejecutamos el metodo de la clase madre
::oMiObjeto := Clase():new() // Instanciamos la data tipo objeto
return self
oXbrw := TXBrowse():new() // objeto sin cambios
oMiBrw := MiTXBrowse():new() // objeto con nueva data y metodo sobreescrito.
Compiling 'Virtual.prg'...
Virtual.prg(725) Error E0030 Syntax error "syntax error at 'METHOD'"
Virtual.prg(726) Error E0030 Syntax error "syntax error at 'METHOD'"
Virtual.prg(728) Error E0030 Syntax error "syntax error at 'CLASS'"
Virtual.prg(729) Error E0030 Syntax error "syntax error at 'CLASS'"
Virtual.prg(730) Error E0030 Syntax error "syntax error at 'CLASS'"
Virtual.prg(732) Error E0030 Syntax error "syntax error at 'CLASS'"
6 errors
No code generated.
Return to FiveWin para Harbour/xHarbour
Users browsing this forum: Adolfredo Martinez and 29 guests