Target not working???

David Burgun dburgun at dsl.pipex.com
Tue Mar 28 06:33:11 EST 2006


Hi Chipp,

On 28 Mar 2006, at 11:01, Chipp Walters wrote:

> David,
>
> On my library stacks I typically have the user type the following:
>
>
> start using stack "myLib"
> myLib_init


Yes, I was thinking it might be better to do it that way too. I still  
haven't made up my mind on it. The thing I was trying to avoid is a  
"stop using" being issued from a stack while other stacks are still  
using it. e.g. I only want to do a "stop using" if this is last stack  
to "stop using". The way it's set up, ISM will issue the "stop using"  
only if it's the last (or only) stack. I set a local variable in the  
ISM de-register handler and then check it in the releaseLibrary  
handler. If the variable it not set correctly then I just do a "start  
using" again! This way rouge "stop using's" have no effect. e.g.  
"start using" and "stop using" MUST be called from the register/de- 
register handlers inside ISM.

> In the myLib_init routine, you can send a callback if you like to  
> the calling stack (use the executionContexts if you like). And if  
> you handle the callback in your library, then you have no worries  
> about it falling through unhandled to the message path.
>
> Or, you can trap the callback, if you wish, in the calling stack  
> and do something with it.
>
> Also, I see where you're using custom props to hold non-permanent  
> data. While this is OK, I prefer to use library stack locals, as  
> these zero out when the app quits. That way you don't have to  
> explicitly reset them. I like customProps for data which may have  
> to be saved between sessions...just my 2 cents.
>

Yes again! I was thinking that too. I coded this way originally to  
aid debugging, e.g. you can look at the custom properties in the  
Stack Inspector at any time and see what is going on. I was actually  
planning on using local's to hold the data and then if Debug Mode is  
on, copy them to the custom property.

Thanks for your suggestions. Any others would be greatly appreciated!

All the Best
Dave




More information about the Use-livecode mailing list