Target not working???
Mark Wieder
mwieder at ahsoftware.net
Mon Mar 27 16:41:15 EST 2006
David-
Monday, March 27, 2006, 9:21:13 AM, you wrote:
> 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?
OK. Now I see what you're trying to do here. But I still see two
problems with this:
One, I don't see a way to differentiate messages coming from multiple
sources. If object A responds to B events, then how do you limit it to
responding only to B event messages from object C? What if object D
also generates B events?
Two, I still think you're fighting the "natural" object hierarchy. Why
not have the stack initialize its own objects when it starts up
instead of forcing it from the parent stack? Or more correctly, why
not have the library stack tell each of its controls to initialize
themselves, i.e.,
-- in the library stack
-- untested code
on openStack
local x
repeat with x=1 to the number of controls of this stack
try
send "ISM_InitializeObject" to control x
end try
end repeat
end openStack
on closeStack
--unregister all objects
end closeStack
Or, if you use setProp handlers instead, you can just say
on openStack
local x
repeat with x=1 to the number of controls of this stack
set the ISM_InitializeObject of control x to empty
end repeat
end openStack
then you don't have to worry about whether or not the control supports
the ISM_InitializeObject handler - you'll just set a harmless custom
property if it doesn't.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list