Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing form properties to procedure files?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00452903
Message ID:
00453213
Views:
29
David,
You can pass a reference to the form itself when you call a function from your procedure file, then use THAT to refer to the various parameters. Assume you have form variables cName, nQuantity and dPurchaseDate. Then, from any method call a function in an outside procedure:
do MyFunc1(thisform)

In MyFunc1 you would have the parameter statement

Function MyFunc1()
lParameter oForm
**  Function Code which gets these 3 variables
oForm.cName = 'David Wheeldon'
oForm.nQuantity = 3
oForm.dPurchaseDate = date()
Now you've updated the form properties with the new values the function developed.

HTH
Barbara


>I only know a little about VFP programming.
>
>I have an app. which has a main form, and a separate procedure.prg file. The app. works fine, but
>I have been trying to modernize my code. I originally had a range of memory variables, all declared public. They could all easily be seen by the procedure.prg where all my functions & procedures are stored.
>
>I have now been replacing all my public memory variables, and making them properties of the form instead.
>
>My problem is I don’t know what the best way to pass these variables (form properties) to the procedure file, or make them visible to the procedure file from anywhere on the form(other than declaring them public). The procedure file will not allow thisform.myproperty code. I have had to repeatedly use code such as
>
>Store Thisform.Myparam to myparamx
>Myfunc = Myfunc1(myparamx)
>
>I seem to have to do this on every one of the pages of the pageframe, because MYPARAMX is invisible to all the other pages. I have to call on it in several places on the form.
>
>Is there an easier way?
>Is it still standard practice to use a seperate .prg procedure file, with code in the form such as SET PROCEDURE TO myprocedure.prg?
>Is it somehow possible to include the code in procedure.prg as part of the form?
>
>Regards David
Barbara Paltiel, Paltiel Inc.
Previous
Reply
Map
View

Click here to load this message in the networking platform