FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Fivewin OOP Question
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Fivewin OOP Question
Posted: Sun Nov 06, 2022 09:32 AM
hi,

when using #xCommand Syntax in CLASS like this
Code (fw): Select all Collapse
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 (fw): Select all Collapse
   ::oASKFORM:oText_2:cTargetDir := cDir + "\"
or must i pass "cTargetDir" as Parameter
Code (fw): Select all Collapse
   cTargetDir := cDir + "\"
greeting,

Jimmy
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 10:19 AM

No, oASKFORM, oText_2 and cTargetDir are independent variables. Please note that you should define LOCAL oASKFORM too.

Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 12:02 PM
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 (fw): Select all Collapse
   ::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 (fw): Select all Collapse
  ::oASKFORM:oText_2:cTargetDir := cDir + "\"  -> crash
Ok, "cTargetDir" is a LOCAL Variable and not a Property

so i try just
Code (fw): Select all Collapse
   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 (fw): Select all Collapse
    ::oParent:oChild_1
under HMG i use "OF" or "PARENT" and can use "semi-OOP" Syntax
Code (fw): Select all Collapse
    oParent.oChild_1
now i have to learn new how to use OOP and what "OF" mean under Fivewin
greeting,

Jimmy
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 12:10 PM
Jimmy wrote:so i try just
Code (fw): Select all Collapse
   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. :-)
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 12:18 PM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 01:26 PM
Beacuse FWH is better OOP design, what else? :-)
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 02:14 PM
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 (fw): Select all Collapse
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
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 02:53 PM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 03:38 PM
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 (fw): Select all Collapse
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 (fw): Select all Collapse
#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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 03:45 PM
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
Posts: 1772
Joined: Thu Sep 05, 2019 05:32 AM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 03:46 PM
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
Posts: 9020
Joined: Thu Oct 06, 2005 08:17 PM
Re: Fivewin OOP Question
Posted: Sun Nov 06, 2022 03:59 PM
Jimmy wrote:hi Enrico,
Something like this?
interesting Code
do it work in MDI Environment as i see no "OF" / "PARENT" Keyword :?:
It should work with any objects.

Continue the discussion