Creating Library Modules
sarah.reichelt at gmail.com
Wed Jul 9 19:02:30 EDT 2008
> I have a Rev 2.9 application that I'm building that creates a set of
> reports. I have the report working as a button in the main stack, but I now
> want to create a library module that will allow me to seperate the report
> code from the main stack so it can be pulled in with different report
> versions as needed.
> I created a new STACK called it "StandardReports.rev"
> I moved the code that I know was working to the "StandardReports.rev" stack
> script area.
> In the original stack I make the following call to see if the new stack is
> if "StandardReports" is not among the lines of the StacksInUse then
> start using stack "StandardReports"
> end if
> The function call to the new stack works, but in that stack there are a
> number of Commands that are defined in the Main Stack that are no longer
> found by the routines in the "StandardReport" stack.
> One example is when I do a DB call, I check for an error with
> handleRevDBerror command that is defined as:
> on handleRevDBerror pError
> case item 1 of pError is "revdberr"
> return "Database Error: " & pError
> end switch
> end handleRevDBerror
> Revolution errors when ever the "StandardReport" stack tries to call this
> What do I need to do to be able to access Commands and Functions that are in
> the Main Stack?
> ALSO, can the "StandardReport.rev" file be placed in any directory or does
> it need to be with the main stack?
Is the StandardReport stack a sub-stack of the Main Stack or is it a
If it is a sub-stack, then it automatically gets access to all the
handlers in the Main Stack, but if it is a separate file, they are
independent. You would then have to "start using" the Main Stack as
well, if you wanted StandardReport to be able to use it's handlers.
The "StandardReport.rev" file can be placed anywhere you like, but if
you want MainStack to be able to refer to it automatically, then se
the Main Stacks stackFiles property to include a reference to
More information about the Use-livecode