Class method

Class method

Postby pawelu » Thu Nov 02, 2006 4:50 pm

Antonio,

Is this possible to create class like this where ::ShowTest() method is call for get object ?

Thanks for help
Pawel

Code: Select all  Expand view
Function ClassTest ()

   Local oTest := Nil

   oTest := Test () : New ()

Return .T.

Class Test

   Data oWnd
   Data oGet1
   Data cGet1 Init Space (10)

   Method New ()
   Method ReadTest ()
   Method ShowTest ()

EndClass

Method New () Class Test

   Define Window ::oWnd Title 'Class Test'
   @ 10, 10 Button 'Ok' Size 60, 20 Pixel Action ::ReadTest ()
   Activate Window ::oWnd

Return Self

Method ReadTest () Class Test

   @ 40, 10 Get ::oGet1 Var ::cGet1 Size 100, 20 Pixel On Change ::ShowTest () Of ::oWnd // this generate error message not found TGET:SHOWTEST
   @ 70, 10 Button 'Ok' Size 60, 20 Pixel Action MsgInfo (Str (::oGet1 : nPos))

Return .T.

Method ShowTest () Class Test

   MsgInfo (Str (::oGet1 : nPos))

Return .T.
pawelu
 
Posts: 126
Joined: Thu Oct 06, 2005 10:18 pm
Location: Poland

Postby Carles » Mon Nov 06, 2006 7:41 am

Hello,

Can you try

Code: Select all  Expand view
...
::oGet1:bChange := {|| ::ShowTest() }
...


Regards.
Salutacions, saludos, regards

"...programar es fácil, hacer programas es difícil..."

UT Page -> https://carles9000.github.io/
Forum UT -> https://discord.gg/bq8a9yGMWh
Skype -> https://join.skype.com/cnzQg3Kr1dnk
User avatar
Carles
 
Posts: 1123
Joined: Fri Feb 10, 2006 2:34 pm
Location: Barcelona

Postby Antonio Linares » Mon Nov 06, 2006 10:42 am

Pawel,

Besides Carles solution, you may do:
Code: Select all  Expand view
Method ReadTest () Class Test
   
   local oThis := Self

   @ 40, 10 Get ::oGet1 Var ::cGet1 Size 100, 20 Pixel On Change oThis:ShowTest () Of ::oWnd
   @ 70, 10 Button 'Ok' Size 60, 20 Pixel Action MsgInfo (Str (::oGet1 : nPos))

Return .T.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41872
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Pocket PC

Who is online

Users browsing this forum: No registered users and 9 guests