Thank you Laurie

I adapted your code to my needs and it works perfectly well
This is what I did, because I do not use public properties, I use the _screen object instead:

In the main form init event

Local oClient as empty

select curClients
go N   && I just go to the record I need to pass to several other forms

scatter name oClient

If not PemStatus(_screen,'oClient',5)
   _screen.Addproperty('oClient',oClient)
else
  _screen.oClient = oClient
endif

in any of the forms that need the object

local oClient
oClient = _screen.oClient

and then use the oClient properties as needed

BTW Dave, I also use an administration object, containing all kinds of methods and properties, for various needs (error log fill, valid dates checking, ie don't accept february 30th, password validation), etc I could place in this object in a general method a variation of your class. This is something I will contemplate in the future, but for now, Laurie's suggestion sufficed)

Thank you both

Rafael Copquin



El 14/04/2015 a las 8:43, Laurie Alvey escribió:
Why not do this in Form1.Init()
IF VARTYPE(goFields) # "O" OR ISNULL(goFields)
     PUBLIC goFields As Empty
ENDIF
Then when you have the data available:
SELECT mycursor
GO 1
SCATTER NAME goFields
In Form2, THIS.myProp = goFields

You'll have to get rid of the public variable in your global clean up by
using RELEASE ALL EXTENDED (you no doubt new that anyway).

Laurie

On 14 April 2015 at 12:11, Dave Crozier <[email protected]> wrote:

Raphael,
You can attach it to _Screen but my preference is to create a global
object from a hand coded class and then add properties to it .... one of
them being your object in question.
Doing it this way means you can always access what you want by using (in
my case) oGlobal in the command window with all its properties and also use
it easily in Debug without having the _Screen prefix which I usually always
forget

Dave

Example

* Mainline.....

=Create_Global_Object()

Addproperty(oGlobal, "MyObject", <myObject>)
...
Return
*
* End of Mainline

Procedure Create_Global_Object
         release oGlobal
         public oGlobal
         oGlobal=Createobject("clsGlobal")
         *
Endproc


****************************
* Global Class
*
define class clsGlobal as relation
         lFoxyPreviewer=.F.
         Sys_User="****"
         Sys_Auth=0
         oUser_Tree_Menu_Form = null

         * Specify the QR Code Object
         oQR_Code = null

         function init()
                 local cApp

                 cApp="FoxyPreviewer.app"

                 This.lFoxyPreviewer=File(cApp)
                 This.oQR_Code = Newobject("FoxBarcodeQR")
                 *
         endfunc
         *
enddefine

-----Original Message-----
From: ProFox [mailto:[email protected]] On Behalf Of Rafael Copquin
Sent: 14 April 2015 12:03
To: profox
Subject: copy objects

I need to create an object in a form with private data session from a
cursor like so:

select mycursor
go 1
scatter name oCur

then I want to place this object on the screen so it can be seen by other
forms with  private data sessions.

The idea is that any of the other forms can get the object from the screen
and then use it inside the form for its own purposes like:

**form2

(get object from screen) copy its properties and contents to the local
object do something

** form3

(get object from screen) copy its properties and contents to the local
object do something

I know that one can pass the object directly to another form like so:
do form form2 with oCur

But in this case I need to keep the object somewhere (the _screen
object) to make it available to more than one form.

How is that done?

TIA

Rafael Copquin



[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to