Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ideas for passing records back to calling form
Message
From
17/09/2015 13:46:55
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Germany
 
 
To
17/09/2015 11:28:13
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 8
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01624724
Message ID:
01624754
Views:
89
>>- return the data as array, rebuild the table
>--> would like to do that but no way to pass an array back from a form correct? (it would have to be a property of an object right)

You can not RETURN an array. But beside that there are ways.

No scx's

I create all my forms as a class in a vcx, doing in general the following for calling:
loForm = newobject('form_class','classlib', ...)

loForm.Put(Whatever_I_need,even_Array)
loForm.Show(1)  &&wait untli finished
loform.get(Whatever_I_need,even_Array)

loform.release
loform = .null.
do not need to return anything from a form.

It has some backdraws like no tables available at design time, but I don't like this anyway.

back reference
An other way would be to hand the form a back reference
The form calling needs a method like:
PROCEDURE PutDataBack
 LPARA taData
 external array taData
*read data ....
ENDPROC
*calling picklist is like:
DO FORM PickList.scx WITH THISFORM && modal form
PickList.scx: methods:
PROCEDURE INIT
 LPARA toBackRef
 this.addproperty('goBackRef',toBackRef)  &&store back reference for later use
 return dodefault()
ENDPROC

PROCEDURE okbutton.click
* ... gather data to array laData
 thisform.goBackRef.PutDataBack(@laData)
ENDPROC
>>- return the data as a string, for example as XML, rebuild from that, a csv string, or a string to a temp csv file will do as well.
>--> probably the "cleanest" going forward if I use this technique in other forms (and easy for another programmer to understand what I am doing)

If you can do that, you can do a real table too.

HTH
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord

Weeks of programming can save you hours of planning.

Off

There is no place like [::1]
Previous
Reply
Map
View

Click here to load this message in the networking platform