Target not working???
Mark Smith
mark at maseurope.net
Mon Mar 27 07:47:50 EST 2006
Since a stack that is in use is available to all other stacks (it's
script has been inserted into back), maybe it would be better simply
for any stack that needs to use the libStack to'register' and
'deregister' with the libStack, which can then put itself in and out
of use as necessary.
in a client stack, for example
on openStack
put the long name of me into myName
send "libStackregister myName" to stack "/Users/Dave/Desktop/
TestLib/Lib.rev"
pass openStack
end openStack
on closeStack
put the long name of me into myName
send "libStackDeregister myName" to stack "/Users/Dave/Desktop/
TestLib/Lib.rev"
pass closeStack
in the libStack
and in the libStack
on libStackRegister tClient
set the clients of me to the clients of me & cr & tClient
start using me
end libStackRegister
on libStackDeregister tClient
put the clients of me into cList
get lineOffset(tClient,cList)
if it > 0 then delete line it of cList
set the clients of me to cList
if the clients of me is empty then stop using me
end libStackDregister
Mark
On 27 Mar 2006, at 12:53, David Burgun wrote:
>
> On 27 Mar 2006, at 11:43, Mark Smith wrote:
>
>> The target of the 'start using' <is> stack TestLib, no?
>
> I'm not sure and a bit confused! But from just experimenting with
> Target a bit more, yes, you are right.
> Yes, that seems like another way to do it.
>
> I would like to scan the script(s) of the stack that just did the
> "start using" and was hoping that I could do it without an
> additional call to the library, since it's a bit error prone and
> it's better practice anyway to do it in the "libraryStack" hanlder.
>
> I could also use a Global and clear it after use, as in:
>
> global gISMStackName
>
> on libraryStack
> if gISMStackName = empty then
> stop using "/Users/Dave/Desktop/TestLib/Lib.rev"
> throw " gISMStackName not set"
> exit libraryStack
> end if
>
> put "libraryStack" & cr after field 1 of me
> put gISMStackName after field 1 of me
> put cr & cr after field 1 of me
> select after field 1 of me
>
> put empty into gISMStackName
> end libraryStack
>
> Then in the stack that does the "start using" do this:
>
> global gISMStackName
>
> on mouseUp
> local myError
>
> put the long name of this stack into gISMStackName
> -- put empty into gISMStackName --Uncomment to test the
> "try"
>
> try
> start using "/Users/Dave/Desktop/TestLib/Lib.rev"
>
> catch myError
> answer myError
> end try
> end mouseUp
>
>
> I'd have to do something similar in the releaseStack handler too.
>
> Not sure what the best way to do this is? What do you think?
>
> All the Best
> Dave
>
>
>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
More information about the use-livecode
mailing list