Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Including function from another prg
Message
De
28/11/2017 08:28:34
Mike Yearwood
Toronto, Ontario, Canada
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 10
Network:
Windows Server 2016
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01655879
Message ID:
01655883
Vues:
65
>Hi all,
>a silly one that I can't square away. I have a program prg1 that has some useful functions. I want to use these functions in program prg2 but if i use set procedure additive I get errors when calling the functions. I can issue the command do prg1 at the top of the program prg2 and I can then use the functions. Am sure there is a better/proper way to open up prg1 and it's functions so I can use them in pgr2 but drawing a blank.
>Thanks
>~M

Yes. You take the functions out of prg1 and prg2. Make them their own .prg files. You can do it one at a time as long as you remove the one from the original prg. They are then accessible at any time, just as FoxPro's own functions are accessible without any SET PROCEDURE command. That is the most natural way to go.

So if you have prg1.prg and in it you have:
function somefunction
lparameters blah
blah
return blah
endfunction

you create:
somefunction.prg
lparameters blah
blah
return blah

I assume you have prg1 and prg2 in a folder in the FoxPro path. Put somefunction.prg in that same folder. The project manager will automatically include it in the exe. Keeping things in a single prg only was needed back in the earliest days because it let us get around the 8 character file names. It isn't needed anymore and always caused problems with multiple developers attempting to access that single prg.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform