Target not working???

Mark Wieder mwieder at ahsoftware.net
Tue Mar 28 15:54:46 EST 2006


David-

Tuesday, March 28, 2006, 10:07:25 AM, you wrote:

> function can be called at anytime, but to make it easier to use, I am
> scanning for the ISM_InitializeObject handler and if it's present,  
> call it. The ISM_InitializeObject in the target object can then call

...there's where I think you're fighting the natural xtalk message
path a bit.

Here's what I do in that situation: place the ISM_InitializeObject
handler in your library stack. Then have the openStack handler of each
stack send "ISM_InitializeObject" to every control in the stack. If
there's a ISM_InitializeObject handler in an object it will be
executed, otherwise the message will pass on down to your library
stack and do some default stuff if necessary. No scanning here.

-- in main stack
on openStack
  local x
  
  repeat with x=1 to the number of controls
    send "ISM_InitializeObject" to control x
  end repeat
end openStack

-- in ISM library stack
on ISM_InitializeObject
  local tTriggers

  -- get the list of events this object handles
  put the uRIP["triggers"] of the target into tTriggers
  repeat for each line tEvent in tTriggers
    -- do a default registration
    ISM_Register the id of the target, tEvent, "*"
  end repeat
end ISM_InitializeObject

-- 
-Mark Wieder
 mwieder at ahsoftware.net




More information about the use-livecode mailing list