Classes inheritance. How to ?

User avatar
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Classes inheritance. How to ?

Post by concentra »

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
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Classes inheritance. How to ?

Post by Gale FORd »

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
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Classes inheritance. How to ?

Post by Enrico Maria Giordano »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Post by concentra »

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: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Post by concentra »

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
jose_murugosa
Posts: 943
Joined: Mon Feb 06, 2006 4:28 pm
Location: Uruguay
Contact:

Article about OOP in fivewin

Post by jose_murugosa »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Post by concentra »

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
James Bott
Posts: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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: 4654
Joined: Fri Nov 18, 2005 4:52 pm
Location: San Diego, California, USA
Contact:

Post by James Bott »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Post by concentra »

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
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Classes inheritance. How to ?

Post by Enrico Maria Giordano »

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
concentra
Posts: 107
Joined: Mon Nov 14, 2005 10:15 am
Location: Brazil

Re: Classes inheritance. How to ?

Post by concentra »

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
Gale FORd
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston
Contact:

Re: Classes inheritance. How to ?

Post by Gale FORd »

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.
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Classes inheritance. How to ?

Post by Enrico Maria Giordano »

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
Post Reply