2 Replies Latest reply on Aug 5, 2013 9:00 AM by mjohnson

    Managing Multiple Application Event Subroutines

    mjohnson

      I recently ran into a problem where I had application event subroutines for the same event coming into conflict with each other. My situation is that I include code from other scripts (sort of like a library), and I ended up with two "Application_BeforeProjectChanged()" subroutines. I didn't get any errors for redefining the subroutine, but it appears that one overwrote / overruled the other. However, from what I can tell, application event subroutines s from two different scripts run at startup appear to both execute.

       

      Are there any other ways of managing multiple application events of the same kind in the same script?

        • 1. Re: Managing Multiple Application Event Subroutines
          Patrick.Cashman

          Probably dumb questions but:

           

          1. I'm having trouble imagining why you'd want the same event to trigger separate responses, at the same time. What are you actually trying to do?

           

          2.  If you really want two things to happen when the event fires, why not just combine the code from both subroutines into one?

          • 2. Re: Managing Multiple Application Event Subroutines
            mjohnson

            Not dumb questions. Firstly, my menu system makes buttons to call external code. Those scripts may have applicaiton events, but my menu system, itself, may have events. This actually seems to be fine. The problem is where I have used ExecuteGlobal to include code (sub menus, libraries). Right now, I am doing as you mentioned and I have rolled all concurrent events up to the top level menu script. I was just wondering if there are more advanced ways for handling application events.