Target not working???
David Burgun
dburgun at dsl.pipex.com
Mon Mar 27 11:49:41 EST 2006
Hi Rob,
On 27 Mar 2006, at 17:30, Rob Cozens wrote:
>
> Dear Dave,
>
>> The idea is that when a Client Stack does a "start using" I want
>> to scan all the scripts in the stack and if there is a handler
>> called "ISM_InitializeObject", call it and when doing a "stop
>> using" I want to call "ISM_FinializeObject".
>>
>> In order to do this I need to know the stack that invoked the the
>> libraryStack and releaseStack handlers.
>>
>
> Suppose instead of (my supposition):
>
> start using stack "ISM_Library.rev"
> ISM_InitializeObject -- or is this in the library's libraryStack
> handler?
>
> The Client Stack did:
>
> start using stack "ISM_Library.rev"
> send "ISM_InitializeOject" to this stack
>
> In ISM_Library--
>
> on ISM_InitializeObject
> put the long name of the target into callingStack
The ISM_InitializeObject handler will be in the Client Stack, but not
just in the Stack Script, in *any* or *all* object(s) in the stack,
e.g. in the Stack, Card(s), Group(s) or Control(s). I want to loop
thru all objects in the stack and if there is an ISM_InitializeObject
handler defined in the script of the object, call it. The same for
ISM_Finialize.
I had just about settled on doing this (Mark Smith came up with this
and I think it's just wonderful!):
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
Which does what I want nicely!
>
> Dave, I'd like to make an observation here without having gotten
> into the details of what you are trying to do:
>
> Some time ago on this list a new RR developer coming from a
> background in C began a discussion about how difficult it was for
> him to deal with the concept of simply placing a message in the
> message chain
>
> ISM_InitializeObject
>
> without specific instructions where, or in how many objects, it
> will trigger some action
>
> send "ISM_InitializeObject" to someControl
>
> The former is truly the essence of XTalk syntax, and much of the
> power available to RR developers can only be invoked by
> understanding & utilizing the message passing hierarchy.
>
> No offense, but unless you feel you totally understand how messages
> can travel & be sent, and where & how handlers can be inserted/
> removed from the message path, you might want to look into the
> subject further. I'm not saying your approach won't work...just IMF
> (oolesh)O it leads you on a path away from the most efficient use
> of Transcript.
Given the above description of what I am trying to do, I'm not sure I
understand what you mean!?!?
All I want to do is to call a handler if it exists in a script. I've
read up on the message path etc. but not sure how it applies in this
case. Could you elaborate?
Many Thanks
All the Best
Dave
More information about the use-livecode
mailing list