re subroutine

Steve Messimer steve at messimercomputing.com
Fri Sep 6 13:01:01 EDT 2002


Esak,

you said...

> Greetings to all
> 
> I like to call subroutine in my progam but when I try Hyperradnd old style
> 
> On Mainprogram
> <code>
> valo (jumpu to sub)
> end Mainprogram
> 
> On valo
> blaa blaaa
> end valo
> 
> it won't work. Runtime tell "cant find the handler"
> 
> How I can call subroutines in Runtime?
> 
> EsaK

When you send a message to an object if its handler is not in the msg
hierarchy  of the sending object, you need to specify its desitnation object
and you need to preface it with the send cmd.

try this ...

On Mainprogram
<code>
  send valo to btn "otherButton" -- the msg can be sent to any other RR
Object. If the btn is on another card you would use this instead
-- send valo to btn "otherButton" of cd "otherCard"
end Mainprogram

On valo
blaa blaaa
end valo

Send is not needed generally if the target handler is in the Objects path,
So in the example above if the handler was in the card that owns the button
the path looks like this btn:Card and you could send the valo msg w/o using
the send command.  valo cks the btn for a handler when it doesn't find one
the msg is sent up the object hierarchy to the card on which the btn
resides. If the on valo handler is in the cards script then it excutes the
code.  If the handler is in another btn on the same card the msg (valo) will
not be trapped by the valo handler because you haven't told it where to go.

Hope this helps

Steve




More information about the use-livecode mailing list