get function() of the target?

Alex Rice alrice at ARCplanning.com
Thu Feb 13 16:57:01 EST 2003


I want some cards to implement an true/false answer for the question 
isActiveCard. The default would be true, implemented at the mainStack 
level. Cards could implement their own isActiveCard, or not. I have 
*lots* of cards, so want to use message path hierarchy wherever 
possible. Consider this situation. In my mainStack script:

function isActiveCard
   return "true" -- default answer, will be overridden in some cards
end isActiveCard
--
on preOpenCard -- skip inactive cards
   if not isActiveCard() then
     go next card
     exit preOpenCard
   end if
   pass preOpenCard
end preOpenCard

In a substack, card script might have

function isActiveCard -- according to the app's data model
  if something then
    return "true"
  else
    return "false"
end isActiveCard

The problem is that when the preOpenCard handler runs in the mainstack, 
I want to call the isActiveCard() function that's defined in *the 
target* card, not the mainstack.
If messages were actually inherited then it wouldn't be a problem, but 
instead of inheritance, the messages travel up the heirarchy.

I've tried

get isActiveCard() of the target

which seems to *actually work according to my intent*, then causes an 
error as soon as soon as I step over it in the debugger. Weird.

Please enlighten me! Thanks,

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the use-livecode mailing list