Page 1 of 2

Classes inheritance. How to ?

Posted: Fri May 12, 2006 7:47 pm
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

Re: Classes inheritance. How to ?

Posted: Fri May 12, 2006 9:04 pm
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

Re: Classes inheritance. How to ?

Posted: Fri May 12, 2006 10:30 pm
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

Posted: Sat May 13, 2006 2:33 am
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

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 11:42 am
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

Posted: Mon May 15, 2006 11:44 am
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

Article about OOP in fivewin

Posted: Mon May 15, 2006 11:48 am
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.

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 11:53 am
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

Posted: Mon May 15, 2006 3:38 pm
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

Posted: Mon May 15, 2006 3:40 pm
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

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 5:51 pm
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

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 6:26 pm
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

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 6:49 pm
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

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 7:12 pm
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.

Re: Classes inheritance. How to ?

Posted: Mon May 15, 2006 8:35 pm
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