Classes inheritance. How to ?

Classes inheritance. How to ?

Postby concentra » Fri May 12, 2006 7:47 pm

Where can I find a tutorial and/or documentation about how to create and inherit FWH classes ?
Is there one around ?
I am triing to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not ot be created at all...
The code is something like this:

Class CL2 from CL1
METHOD PrintCl()
ENDCLASS

METHOD PrintCl() class CL2
alert("CL2")
return NIL

Questions:
Al the CL1 methods are avaiable in CL2 ?
Do I need a constructor/destructor method or the CL1 one is used ?

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Postby Gale FORd » Fri May 12, 2006 9:04 pm

concentra wrote:Where can I find a tutorial and/or documentation about how to create and inherit FWH classes ?
Is there one around ?
I am triing to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not ot be created at all...
The code is something like this:

Class CL2 from CL1
METHOD PrintCl()
ENDCLASS

METHOD PrintCl() class CL2
alert("CL2")

return NIL

Questions:
Al the CL1 methods are avaiable in CL2 ?
Do I need a constructor/destructor method or the CL1 one is used ?

[[]] Maurício Faria


Don't forget to add:

CLASSDATA lRegistered AS LOGICAL
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Classes inheritance. How to ?

Postby Enrico Maria Giordano » Fri May 12, 2006 10:30 pm

concentra wrote:Where can I find a tutorial and/or documentation about how to create and inherit FWH classes ?


Best documentation is FWH source code.

concentra wrote:I am triing to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not ot be created at all...
The code is something like this:

Class CL2 from CL1
METHOD PrintCl()
ENDCLASS

METHOD PrintCl() class CL2
alert("CL2")
return NIL


Can you build a little real (compilable) sample of the problem?

concentra wrote:Questions:
Al the CL1 methods are avaiable in CL2 ?


Yes.

concentra wrote:Do I need a constructor/destructor method or the CL1 one is used ?


Yes, you need of a constructor.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby James Bott » Sat May 13, 2006 2:33 am

Maurício,

There are a couple of articles that I wrote on this available on my website here:

http://ourworld.compuserve.com/homepage ... rogram.htm

The article, "Introduction to Object-Oriented Programming Using FiveWin" is in two parts.

>I am getting an error that I don´t have if I use the original class.

I see nothing wrong with the code you show so the problem must be in the code you didn't show us. Can you provide us with a small REAL example. Which FW class are trying to inherit from? What is the error you are getting? What version of FW are you using?

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Classes inheritance. How to ?

Postby concentra » Mon May 15, 2006 11:42 am

Gale FORd wrote:
concentra wrote:Where can I find a tutorial and/or documentation about how to create and inherit FWH classes ?
Is there one around ?
I am triing to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not ot be created at all...
The code is something like this:

Class CL2 from CL1
METHOD PrintCl()
ENDCLASS

METHOD PrintCl() class CL2
alert("CL2")

return NIL

Questions:
Al the CL1 methods are avaiable in CL2 ?
Do I need a constructor/destructor method or the CL1 one is used ?

[[]] Maurício Faria


Don't forget to add:

CLASSDATA lRegistered AS LOGICAL


Why ?
What is "lRegistered" ?

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby concentra » Mon May 15, 2006 11:44 am

James Bott wrote:Maurício,

There are a couple of articles that I wrote on this available on my website here:

http://ourworld.compuserve.com/homepage ... rogram.htm

The article, "Introduction to Object-Oriented Programming Using FiveWin" is in two parts.

>I am getting an error that I don´t have if I use the original class.

I see nothing wrong with the code you show so the problem must be in the code you didn't show us. Can you provide us with a small REAL example. Which FW class are trying to inherit from? What is the error you are getting? What version of FW are you using?

James


Thanks James.
I am reading it and it seems very usefull for a beginning.
Can I translate to Portuguese ?

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Article about OOP in fivewin

Postby jose_murugosa » Mon May 15, 2006 11:48 am

James,

Your articles are very interesting, I´m studying them.

I will translate them to spanish and send to your e-mail.
Saludos/Regards,
José Murugosa
FWH + Harbour + Bcc7. Una seda!
User avatar
jose_murugosa
 
Posts: 1145
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay

Re: Classes inheritance. How to ?

Postby concentra » Mon May 15, 2006 11:53 am

EnricoMaria wrote:
concentra wrote:Where can I find a tutorial and/or documentation about how to create and inherit FWH classes ?


Best documentation is FWH source code.


I tried but could not figure out what is wrong with my code.
I thought I needed to study a little if some docs are avaiable.

EnricoMaria wrote:
concentra wrote:I am triing to inherit a class from another because I need to add a method.
I am getting an error that I don´t have if I use the original class.
The object seems not ot be created at all...
The code is something like this:

Class CL2 from CL1
METHOD PrintCl()
ENDCLASS

METHOD PrintCl() class CL2
alert("CL2")
return NIL


Can you build a little real (compilable) sample of the problem?



I am triing to add some methods to the SuperBrowse class without modifiing it, and so I tried to inherit it, creating a particular class.
I will try to find what is wrong with the code with the help you gave me and if I can´t I will try to post complete code.

EnricoMaria wrote:
concentra wrote:Questions:
Al the CL1 methods are avaiable in CL2 ?


Yes.

concentra wrote:Do I need a constructor/destructor method or the CL1 one is used ?


Yes, you need of a constructor.

EMG


[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Postby James Bott » Mon May 15, 2006 3:38 pm

Maurício,

>Can I translate to Portuguese?

Sure. Please send me a copy and I will put it up on my site.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Postby James Bott » Mon May 15, 2006 3:40 pm

José,

>I will translate them to spanish and send to your e-mail.

Great. I will put that version on my site too.

James
User avatar
James Bott
 
Posts: 4840
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA

Re: Classes inheritance. How to ?

Postby concentra » Mon May 15, 2006 5:51 pm

Gale FORd wrote:Don't forget to add:
CLASSDATA lRegistered AS LOGICAL

Bingo !!!!!
Added this single line and my inherited class worked like a charm...
Thanks Gale, but what the hell is "lRegistered" ?

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Postby Enrico Maria Giordano » Mon May 15, 2006 6:26 pm

It is a flag that allows a one-time registration of a control class. It is needed to get Windows aware of the new control.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Classes inheritance. How to ?

Postby concentra » Mon May 15, 2006 6:49 pm

EnricoMaria wrote:It is a flag that allows a one-time registration of a control class. It is needed to get Windows aware of the new control.
EMG


Ok, but could you tell me when I need it and when I do not ?

[[]] Maurício Faria
User avatar
concentra
 
Posts: 124
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Postby Gale FORd » Mon May 15, 2006 7:12 pm

concentra wrote:
EnricoMaria wrote:It is a flag that allows a one-time registration of a control class. It is needed to get Windows aware of the new control.
EMG


Ok, but could you tell me when I need it and when I do not ?

[[]] Maurício Faria


If you are creating a temporary stand alone class from scratch and you will not inherit from it then it is not required

If you plan on inheriting from your class or your class is inheriting from another, then you will need to add it.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: Classes inheritance. How to ?

Postby Enrico Maria Giordano » Mon May 15, 2006 8:35 pm

Gale FORd wrote:If you are creating a temporary stand alone class from scratch and you will not inherit from it then it is not required

If you plan on inheriting from your class or your class is inheriting from another, then you will need to add it.


No, you will only need it if you are going to make a control. Not all classes are controls.

EMG
User avatar
Enrico Maria Giordano
 
Posts: 8419
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 29 guests