Página 1 de 1

Change a Method

Publicado: Vie Mar 31, 2006 7:03 pm
por Aguiar Costa
Hi
I tried to add a new parameter on AddCol() method from TBrowse class like
this :
*****
CLASS TBrowse FROM XBrowse
PUBLIC:
METHOD AddCol( oCol , lRefresh , cHeader )
ENDCLASS
METHOD AddCol( oCol , lRefresh , cHeader )
LOCAL oCol1 := SUPER:AddCol( oCol , lRefresh )
If !Empty(cHeader)
oCol1:cHeader := cHeader
EndIf
RETURN oCol1
*****
It works, the new column is created but with no header text.
Doing the same but changing the method's name it works just fine:
****
CLASS TBrowse FROM XBrowse
PUBLIC:
METHOD AddCol2( oCol , lRefresh , cHeader )
ENDCLASS
METHOD AddCol2( oCol , lRefresh , cHeader )
LOCAL oCol1 := SUPER:AddCol( oCol , lRefresh )
If !Empty(cHeader)
oCol1:cHeader := cHeader
EndIf
RETURN oCol1
****
What can i do to use the same method name and add a new parameter ?
TIA.
Aguiar !!!

Change a Method

Publicado: Vie Mar 31, 2006 7:30 pm
por ignacio
Aguiar,
It should work. Every thing seems to be correct. If lRefresh is .T. you may
need to provoke a new Refresh. Please send us a small sample.
Regards,
"Aguiar Costa" <Aguiar.Costa@Sisbit.pt> escribió en el mensaje
news:[email=442d6013@ozsrvnegro.ozlan.local...]442d6013@ozsrvnegro.ozlan.local...[/email]
> Hi
>
> I tried to add a new parameter on AddCol() method from TBrowse class like
> this :
> *****
> CLASS TBrowse FROM XBrowse
> PUBLIC:
> METHOD AddCol( oCol , lRefresh , cHeader )
>
> ENDCLASS
>
> METHOD AddCol( oCol , lRefresh , cHeader )
>
> LOCAL oCol1 := SUPER:AddCol( oCol , lRefresh )
>
> If !Empty(cHeader)
> oCol1:cHeader := cHeader
> EndIf
>
> RETURN oCol1
> *****
> It works, the new column is created but with no header text.
> Doing the same but changing the method's name it works just fine:
> ****
> CLASS TBrowse FROM XBrowse
> PUBLIC:
> METHOD AddCol2( oCol , lRefresh , cHeader )
>
> ENDCLASS
>
> METHOD AddCol2( oCol , lRefresh , cHeader )
>
> LOCAL oCol1 := SUPER:AddCol( oCol , lRefresh )
>
> If !Empty(cHeader)
> oCol1:cHeader := cHeader
> EndIf
>
> RETURN oCol1
> ****
> What can i do to use the same method name and add a new parameter ?
> TIA.
> Aguiar !!!
>