Whether returning multiple properties from an object, or passing
multiple properties to an object, we use the same mechanism.  We use a
Property Bag object.  This is similar to a SCATTER NAME object and is an
object which contains properties relating to each item of informtation.
You simply add the properties to the object as they are required.

Local loPropertyBag, loForm
loPropertyBag = CreateObject("clsPropertyBag")
With loPropertyBag
        .AddProperty("NewProperty1", "New Value 1")
        .AddProperty("NewProperty2", "New Value 1")
EndWith
        
loForm = CreateObject("frmNewForm", loPropertyBag)

In VFP9 a suitable candidate for the Property Bag would be the Empty
class:

Local loPropertyBag
loPropertyBag = CreateObject("Empty")
ADDPROPERTY(loPropertyBag, "Property1", "Value1")

Dominic Burford

"I conclude that there are two ways of constructing a software design:
One way is to make it so simple there are obviously no deficiencies, and
the other way is to make it so complicated that there are no obvious
deficiencies." -- Tony Hoare, Turing Award Lecture 1980


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Paul Newton
Sent: 01 November 2006 10:13
To: ProFox
Subject: Returning one (or more) values from a form, including arrnys -
non-OOP

Hi all

This is in reaction (response is perhaps not quite the right term) to
solving the problem of returning an array from a form without the use of
custom objects.  It should work from anywhere (including calling the
form from the command window).  Reading previous threads (which have
often digressed and talked about OO approaches when a non-OO solution
was being sought), did not clarify the issue for me and it does not
appear to be as simple as whether the array is passed by reference or
not.  So here is what *works*.  It also demonstrates how to return more
than one value from a form.

In command window (or anywhere else)

DIME myArray(1)   && myArray (see below) MUST be an array if you want an

array returned
MyVar = "" && Can be any data type you like

DO FORM frmMyForm WITH "myArray","MyVar"   && second parameter is
optional

frmMyForm.Init   && frmMyForm has properties cParam1 and cParam2

PARAMETERS tcArrayName, tcParam2

THIS.cParam1 = tcArrayName
THIS.cParam2 = tcParam2

frmMyForm.Unload

*- The next line is where it is important that the value passed as a
parameter ("myArray") represents an existing array
ACOPY(THIS.aFiles,(THIS.cParam1))   && Example only - Unload method 
could create a local array and ACOPY that instead

*- In the next line it is *not* critical that the value stored to the
variable is of the same type as stored in the original variable STORE
"This is a test" TO (THIS.cParam2)
*- STORE 9 TO (THIS.cParam2)
*- STORE DATE() TO (THIS.cParam2)

RETURN


HTH somebody in the future

Comments welcome





_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list:
http://leafe.com/mailman/listinfo/profoxtech
** 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.

______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________

______________________________________________________________________
Pegasus Software Limited is an Infor company.

This e-mail is from Pegasus Software Limited. The e-mail and any files 
transmitted with it are confidential and intended solely for the use of the 
individual or entity to whom it is addressed. If you have received this e-mail 
in error you must not copy, distribute or take any action in reliance on it. 
Please notify the sender by e-mail or telephone.

Pegasus Software Limited utilises an anti-virus system and therefore any files 
sent via e-mail will have been checked for known viruses. You are however 
advised to run your own virus check before opening any attachments received as 
Pegasus Software Limited will not in any event accept any liability whatsoever 
once an e-mail and/or any attachment is received.

This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________


_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** 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