Fivewin OOP Question

Fivewin OOP Question

Postby Jimmy » Sun Nov 06, 2022 9:32 am

hi,

when using #xCommand Syntax in CLASS like this
Code: Select all  Expand view
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 view
  ::oASKFORM:oText_2:cTargetDir := cDir + "\"


or must i pass "cTargetDir" as Parameter
Code: Select all  Expand view
  cTargetDir := cDir + "\"
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

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

Re: Fivewin OOP Question

Postby Jimmy » 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: Select all  Expand view
  ::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 view
 ::oASKFORM:oText_2:cTargetDir := cDir + "\"  -> crash

Ok, "cTargetDir" is a LOCAL Variable and not a Property

so i try just
Code: Select all  Expand view
  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 view
   ::oParent:oChild_1


under HMG i use "OF" or "PARENT" and can use "semi-OOP" Syntax
Code: Select all  Expand view
   oParent.oChild_1


now i have to learn new how to use OOP and what "OF" mean under Fivewin
greeting,
Jimmy
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

Postby Enrico Maria Giordano » Sun Nov 06, 2022 12:10 pm

Jimmy wrote:so i try just
Code: Select all  Expand view
  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
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Fivewin OOP Question

Postby Jimmy » 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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

Postby Enrico Maria Giordano » Sun Nov 06, 2022 1:26 pm

Beacuse FWH is better OOP design, what else? :-)
User avatar
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Fivewin OOP Question

Postby Jimmy » Sun Nov 06, 2022 2: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: Select all  Expand view
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
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

Postby Marc Venken » Sun Nov 06, 2022 2: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1426
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Fivewin OOP Question

Postby Enrico Maria Giordano » Sun Nov 06, 2022 3: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: Select all  Expand view
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 view
#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
Enrico Maria Giordano
 
Posts: 8710
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Re: Fivewin OOP Question

Postby Jimmy » Sun Nov 06, 2022 3: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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

Postby Jimmy » Sun Nov 06, 2022 3: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
User avatar
Jimmy
 
Posts: 1725
Joined: Thu Sep 05, 2019 5:32 am
Location: Hamburg, Germany

Re: Fivewin OOP Question

Postby Enrico Maria Giordano » Sun Nov 06, 2022 3:59 pm

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


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 88 guests