OVERRIDE

OVERRIDE

Postby Silvio.Falconi » Mon Nov 13, 2023 11:19 am

I saw that I can modify a method of a class directly with the OVERRIDE command without having to modify the class.
Can I add Data or new methods with the same technique? and how ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: OVERRIDE

Postby Antonio Linares » Mon Nov 13, 2023 11:25 am

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: OVERRIDE

Postby Silvio.Falconi » Mon Nov 13, 2023 11:49 am

Antonio Linares wrote:Dear Silvio,

Please review this:
https://github.com/harbour/core/blob/master/src/rtl/objfunc.prg



for modify a Method run ok with

Code: Select all  Expand view
#xcommand OVERRIDE METHOD <!Message!> [IN] CLASS <!Class!> ;
                             WITH [METHOD] <!Method!> [SCOPE <Scope>] => ;
            __clsModMsg( <Class>():classH, #<Message>, @<Method>() )


sample:

Code: Select all  Expand view
OVERRIDE METHOD BuildButtonBar IN CLASS TPreview WITH PreviewBuildButtonBar


I not found the #command to add data or add methods

EXTEND CLASS TPreview WITH DATA aDefaultCols not run
Last edited by Silvio.Falconi on Mon Nov 13, 2023 11:59 am, edited 1 time in total.
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: OVERRIDE

Postby Antonio Linares » Mon Nov 13, 2023 11:52 am

FUNCTION __objAddData( oObject, cSymbol )

it is inside:
https://github.com/harbour/core/blob/master/src/rtl/objfunc.prg
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: OVERRIDE

Postby Silvio.Falconi » Mon Nov 13, 2023 12:02 pm

Antonio Linares wrote:FUNCTION __objAddData( oObject, cSymbol )

it is inside:
https://github.com/harbour/core/blob/master/src/rtl/objfunc.prg


I tried with

#xcommand EXTEND DATA <!Message!> [IN] CLASS <!Class!>
__objAddData( <Class>():classH, #<Message> )

EXTEND DATA aDefaultCols IN CLASS TPreview

not run

make error on compilation

ut_over_Bro.prg(8) Error E0007 Missing => in #translate/#command
ut_over_Bro.prg(9) Error E0030 Syntax error "syntax error at '<'"
ut_over_Bro.prg(12) Error E0030 Syntax error "syntax error at 'DATA'"
ut_over_Bro.prg(13) Error E0030 Syntax error "syntax error at 'DATA'"
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: OVERRIDE

Postby Silvio.Falconi » Mon Nov 13, 2023 12:12 pm

#xcommand EXTEND DATA <!Message!> [IN] CLASS <!Class!> => ;
__objAddData( <Class>():classH, #<Message> )

seem run ok then

if I add a data sample :

EXTEND DATA aDefaultCols IN CLASS TXBrowse

give me an error

Error occurred at: 11/13/23, 13:13:45
Error description: Error BASE/3101 Argument error: __OBJADDDATA

Stack Calls
===========
Called from: => __ERRRT_BASE( 0 )
Called from: ../../../objfunc.prg => __OBJADDDATA( 0 )
Called from: ut_over_Bro.prg => UT_OVERRIDE( 12 )
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: OVERRIDE

Postby Antonio Linares » Mon Nov 13, 2023 4:04 pm

Dear Silvio,

You add a new DATA to the object, not to the class:

#xcommand EXTEND DATA <!Message!> [IN] OBJECT <!object!> => ;
__objAddData( <object>, #<Message> )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: OVERRIDE

Postby Silvio.Falconi » Tue Nov 14, 2023 8:52 am

Antonio Linares wrote:Dear Silvio,

You add a new DATA to the object, not to the class:

#xcommand EXTEND DATA <!Message!> [IN] OBJECT <!object!> => ;
__objAddData( <object>, #<Message> )


which is the object ?

sample
If I must add a data into Txbrowse how I can make ?


EXTEND DATA aDefaultCols IN OBJECT TXBrowse

give me not found txbrowse
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7052
Joined: Thu Oct 18, 2012 7:17 pm

Re: OVERRIDE

Postby Antonio Linares » Tue Nov 14, 2023 2:03 pm

Dear Silvio,

This example works fine:
Code: Select all  Expand view
function Main()

   local oError := ErrorNew()
   
   __objAddData( oError, "test" )
   
   oError:test = "hello"
   ? oError:test

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 49 guests