Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Hidden method in PRG
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01033728
Message ID:
01033932
Vues:
24
Very Nice! Learn something new every day. 3 Stars (if I could) and a "Why didn't I know this?" to you Bo. I tested it, and it does indeed work as advertised. Not that I doubted you, but sometimes seeing is believing.

>>Hi all, I have put a couple of routines in a prg file, and many of
>> them share use a common subroutine. That subroutine will only be
>> called by those routines in that same prg file. Is there a way to
>> make that subroutine "hidden" in that prg file, similar to the hidden
>> method of a class?
>
>If the common subroutine is only called from within the same PRG, you don't have to make it hidden. VFP will search inside the PRG before searching the SET PROCEDURE stack:
>
>
>** Main.prg *********************
>SET PROCEDURE TO prg1
>SET PROCEDURE TO prg2 ADDITIVE
>proc1()
>proc2()
>
>
>** prg1.prg *********************
>FUNCTION Proc1()
>   CommonProc()
>ENDFUNC
>
>FUNCTION CommonProc()
>   ?SYS(16)
>ENDFUNC
>
>
>** prg2.prg *********************
>FUNCTION Proc2()
>   CommonProc()
>ENDFUNC
>
>FUNCTION CommonProc()
>   ?SYS(16)
>ENDFUNC
>
>
>** OUTPUT :
>> PROCEDURE COMMONPROC PRG1.FXP
>> PROCEDURE COMMONPROC PRG2.FXP
>
>
>
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform