Page 1 of 1
OVERRIDE METHOD
Posted: Thu Mar 05, 2009 10:43 am
by jicorral
I'm trying to replace HaldleEvento from TControl:
Code: Select all
function Main()
lChDir(cFilePath(HB_ARGV(0)))
OVERRIDE METHOD HandleEvent IN CLASS TControl WITH ControlHE // <--------------
SET HELPFILE TO "ayuda1.chm"
SetHelpPopup('Ayuda.txt')
DEFINE WINDOW oWnd FROM 1, 1 TO 40, 120 ;
MENU BuildMenu()
oWnd:nHelpID := 'Intro'
ACTIVATE WINDOW oWnd
return nil
......
static function ControlHE( nMsg, nWParam, nLParam )
local Self := HB_QSelf()
...
But I'm getting this error:
Code: Select all
ayuda1.PRG(17) Error E0030 Syntax error "syntax error at 'METHOD'"
Any idea?
Re: OVERRIDE METHOD
Posted: Thu Mar 05, 2009 11:55 am
by Enrico Maria Giordano
Please include
#include "Hbclass.ch"
EMG
Re: OVERRIDE METHOD
Posted: Thu Mar 05, 2009 4:39 pm
by jicorral
I have it included:
Code: Select all
#include "FiveWin.ch"
#include "InKey.ch"
#include "hbclass.ch"
#include "..\res\resources.h"
static oWnd
//----------------------------------------------------------------------------//
function Main()
lChDir(cFilePath(HB_ARGV(0)))
OVERRIDE METHOD HandleEvent IN CLASS TControl WITH ControlHE
SET HELPFILE TO "ayuda1.chm"
SetHelpPopup('Ayuda.txt')
DEFINE WINDOW oWnd FROM 1, 1 TO 40, 120 ;
MENU BuildMenu()
oWnd:nHelpID := 'Intro'
ACTIVATE WINDOW oWnd
return ni
Re: OVERRIDE METHOD
Posted: Thu Mar 05, 2009 6:28 pm
by Enrico Maria Giordano
Are you using Harbour or xHarbour?
EMG
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 9:51 am
by jicorral
Harbour 902
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 10:03 am
by Antonio Linares
Jorge Ignacio,
Harbour does not support OVERRIDE METHOD yet
You need to use xHarbour to have it
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 10:16 am
by jicorral
Oppss. Thx a lot.
So there is no way to replace a class method with harbour? I have found way to do it with an object but I need to do it with the class on application scope.
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 11:25 am
by Enrico Maria Giordano
This is from Przemek:
Code: Select all
#xcommand OVERRIDE METHOD <!Message!> [IN] CLASS <!Class!> WITH [METHOD] ;
<!Method!> [SCOPE <Scope>] => ;
__clsModMsg( <Class>():classH, #<Message>, @<Method>(), ;
IIF( <.Scope.>, <Scope>, HB_OO_CLSTP_EXPORTED ) )
EMG
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 12:46 pm
by jicorral
Great! Do it! Thx a lot.
Re: OVERRIDE METHOD
Posted: Fri Mar 06, 2009 6:39 pm
by Antonio Linares
Enrico,
Thanks!