Fivewin OOP Question

Post Reply
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Fivewin OOP Question

Post by Jimmy »

hi,

when using #xCommand Syntax in CLASS like this

Code: Select all | Expand

LOCAL oText_2, cTargetDir

   DEFINE WINDOW oASKFORM FROM 0,0 TO 270, 534 PIXEL TITLE cAction
   @ 110,10 GET oText_2 VAR cTargetDir SIZE 500,30 PIXEL FONT oFontDefault OF oASKFORM
 
will VAR "cTargetDir" be Property of oText_2 :?:

if YES
can write

Code: Select all | Expand

   ::oASKFORM:oText_2:cTargetDir := cDir + "\"
or must i pass "cTargetDir" as Parameter

Code: Select all | Expand

   cTargetDir := cDir + "\"
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Fivewin OOP Question

Post by Enrico Maria Giordano »

No, oASKFORM, oText_2 and cTargetDir are independent variables. Please note that you should define LOCAL oASKFORM too.
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin OOP Question

Post by Jimmy »

hi Enrico,

Ok, understand
so i have to make a own CLASS and use CLASS Code / DATA when i do not want to pass Parameter

---

have forgot to say that i have DATA oASKFORM and made this

Code: Select all | Expand

   ::oASKFORM := oASKFORM
but still my Question about Object and "OF Parent"
when assign Object to a Parent, a Parent should know it´s Child :!:

i have try first

Code: Select all | Expand

  ::oASKFORM:oText_2:cTargetDir := cDir + "\"  -> crash
Ok, "cTargetDir" is a LOCAL Variable and not a Property

so i try just

Code: Select all | Expand

   xxx := ::oASKFORM:oText_2
but still got
Message not found: TWINDOW:OTEXT_2
so not ::oASKFORM is "Parent" but "Super-CLASS" TWINDOW

---

under Xbase++ all Control of XbpDialog ( WINDOW / DIALOG ) are Child so you can use

Code: Select all | Expand

    ::oParent:oChild_1
under HMG i use "OF" or "PARENT" and can use "semi-OOP" Syntax

Code: Select all | Expand

    oParent.oChild_1
now i have to learn new how to use OOP and what "OF" mean under Fivewin
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Fivewin OOP Question

Post by Enrico Maria Giordano »

Jimmy wrote:so i try just

Code: Select all | Expand

   xxx := ::oASKFORM:oText_2
but still got
Message not found: TWINDOW:OTEXT_2
Of course: oText_2 is not a property of oASKFORM, it is a local variable! I think you should have to carefully read a good book about OOP. :-)
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin OOP Question

Post by Jimmy »

hi,
Enrico Maria Giordano wrote:Of course: oText_2 is not a property of oASKFORM, it is a local variable!
right but i use "OF" which work under HMG "as expect" using "semi-OOP" Syntax
Enrico Maria Giordano wrote:I think you should have to carefully read a good book about OOP. :-)
sorry, it work that Way under Xbase++ and HMG so why not under Fivewin :?:

p.s. i did work with OOP and Xbasse++ over 20 Year and 3 Year with HMG
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Fivewin OOP Question

Post by Enrico Maria Giordano »

Beacuse FWH is better OOP design, what else? :-)
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin OOP Question

Post by Jimmy »

hi Enrico,

i can´t talk about Fivewin OOP yet while have not made enough CODE

i have learn using "OF" under HMG and it work like OOP :D
you also can use

Code: Select all | Expand

SetProperty()
GetProperty()
DoMethod()
like ActiveX OOP which work under every Language

---

i have hope to use #xCommand Syntax in Fivewin CLASS but it seems not good to mix it with CLASS Code
i´m still a Newbie under Fivewin and have a lot to learn.

but i "think" also Fivewin can learn what "other" is doing like "semi-OOP" Style using "OF" / "PARENT"
it would be nice to have when become use to it

p.s. have still not figure out how HMG / Extended Version does "semi-OOP" Style
greeting,
Jimmy
User avatar
Marc Venken
Posts: 1485
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Fivewin OOP Question

Post by Marc Venken »

Jimmy,

Maybe this link can give you some insite : It is from Mr. James Bott (Mr. OOP for me :D ) James, with respect !!

http://gointellitech.com/oop1.html
http://gointellitech.com/oop2.html
Marc Venken
Using: FWH 23.08 with Harbour
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Fivewin OOP Question

Post by Enrico Maria Giordano »

Jimmy wrote:hi Enrico,

i can´t talk about Fivewin OOP yet while have not made enough CODE

i have learn using "OF" under HMG and it work like OOP :D
you also can use

Code: Select all | Expand

SetProperty()
GetProperty()
DoMethod()
like ActiveX OOP which work under every Language

---

i have hope to use #xCommand Syntax in Fivewin CLASS but it seems not good to mix it with CLASS Code
i´m still a Newbie under Fivewin and have a lot to learn.

but i "think" also Fivewin can learn what "other" is doing like "semi-OOP" Style using "OF" / "PARENT"
it would be nice to have when become use to it

p.s. have still not figure out how HMG / Extended Version does "semi-OOP" Style
Something like this?

Code: Select all | Expand

#include "Fivewin.ch"


FUNCTION MAIN()

    LOCAL oDlg

    #ifdef __XHARBOUR__
        EXTEND CLASS TDialog WITH MESSAGE Test INLINE Test()
    #else
        __CLSADDMSG( TDialog():classH, "Test", { || Test() }, HB_OO_MSG_INLINE )
    #endif

    DEFINE DIALOG oDlg

    @ 1, 1 BUTTON "Test";
           ACTION oDlg:Test( "Hello" )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION TEST()

    ? "Hello"

    RETURN NIL
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin OOP Question

Post by Jimmy »

hi Enrico,
Enrico Maria Giordano wrote:Something like this?
interesting Code
do it work in MDI Environment as i see no "OF" / "PARENT" Keyword :?:
greeting,
Jimmy
User avatar
Jimmy
Posts: 1740
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany
Has thanked: 2 times

Re: Fivewin OOP Question

Post by Jimmy »

hi Marc,
Marc Venken wrote:Maybe this link can give you some insite : It is from Mr. James Bott (Mr. OOP for me :D ) James, with respect !!

http://gointellitech.com/oop1.html
http://gointellitech.com/oop2.html
thx for Link. i will study it
greeting,
Jimmy
User avatar
Enrico Maria Giordano
Posts: 8753
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Has thanked: 1 time
Been thanked: 4 times
Contact:

Re: Fivewin OOP Question

Post by Enrico Maria Giordano »

Jimmy wrote:hi Enrico,
Enrico Maria Giordano wrote:Something like this?
interesting Code
do it work in MDI Environment as i see no "OF" / "PARENT" Keyword :?:
It should work with any objects.
Post Reply