Inserting an idle handler into the message path

Dar Scott dsc at swcp.com
Sun Nov 23 21:25:35 EST 2003


On Sunday, November 23, 2003, at 04:14 PM, jps2 wrote:

>>> I had similar problems, and worse performance, using "send...to".
>>
>> What kinds of problems?
>
> I am using a stack with "start using" and then in the "on libraryStack"
> handler I insert scripts into the front and back. I can call handlers 
> in these
> scripts from the main (non library) stack without a problem, but 
> messages
> generated in these scripts never reach the original stack, they seem 
> to be
> only passed through the library stack itself.
>
> Am I going about this in the wrong way? I'd like to extend the message 
> path to
> have custom events pass through the stack that is using the library.

I have to make some guesses here about your needs.

If you have several stacks that might be using the library, each can 
supply to the library the long id of itself like this:

    openGadget GadgetNumber, the long id of me

The library can send responses back to the saved long id like this:

    send "gadgetIsOpened gadgetNum" to savedLongID in 0 seconds

Use the 0 seconds to allow it to drop through the path and to allow for 
an undefined handler.

You can eventually expand this to have arrays to keep track of multiple 
gadgets.

If you have only one stack that is the customer, then you might 
consider using topStack instead of passing the long ID.

Does this work, or are there problems with this?

Dar Scott





More information about the use-livecode mailing list