we can pass info to and retrieve info from a form like this:

   do form with arg1,arg2 to result

which is similar to calling a function:

   result = form(arg1,arg2)

when i am developing a form, i often need to change the number of input and output arguments, which means i need to constantly adjust the form calling interface. 

by using a parameter object as an input/output mechanism simplifies it like below:

local loparam
loparam = createobject('empty')
addproperty(loparam,'input',"input_value")
addproperty(loparam,'output')
do form with loparam
? loparam.output

also the use of parameter object makes it flexible in when and where to assign the output value, i.e. not restricted to returning a single entity in the unload event of the form.

i have made a screencast showing that here at showmedo.com.

 

One Response to Passing a parameter object to a form

  • Ian Ozsvald says:

    Hi David, your screencast for us is a really nice example of how to share a strong technique with other people.  It is so much easier to just see it in action and *know* how it’ll work.

    We’re keen to welcome many more videos from you.  I had no idea that there was an active VFP developer community (I’m Python/C++, I’ve never used VFP) – the news site you showed me is really nice.  Grand stuff!

    Ian.

Leave a Reply

Your email address will not be published. Required fields are marked *