` Re-using routines (Dan Presnell ) - Icetips Article
Icetips - Templates, Tools & Utilities for Clarion Developers

Templates, Tools and Utilities
for Clarion Developers

Icetips Article

Back to article list   Search Articles     Add Comment     Printer friendly     Direct link  

Par2: Re-using routines
1999-04-20 -- Dan Presnell
 
> In cw5ee is there any way to create a create a global routine? > Basically I need to use the exact same piece of code in several places, > but it needs to manipulate many pieces of data local to each of the > procedures. There is a way, if the variables, fields, and controls the routine manipultes or refers to are all named the same in each procedure. 1. In the one procedure where you have written your routine, surround it with a SECTION statement, like this: SECTION('MYROUTINE', '***') myroutine routine ! some code here *** 2. Note the module that procedure is in (such as MYPRG001.CLW), and uncheck the "Allow repopulate" option for the module so it doesn't get renamed. 3. Now in all the other procedures where you need the routine, in the Procedure Routines embed, put this: include('myprg007.clw', 'MYROUTINE') This method can come in handy if, for example, the routine refers to a very large number of controls on a report or window and you don't want to write a procedure passing each as a parameter.


Today is April 25, 2024, 12:59 pm
This article has been viewed 35109 times.



Back to article list   Search Articles   Add Comment   Printer friendly

Login

User Name:

Password: