Messages
Mark Wieder
mwieder at ahsoftware.net
Sun Sep 4 14:13:59 EDT 2005
Tom-
And just to make things a bit clearer:
There are three objects drinking at a bar:
A button, a card, and a stack.
The button only drinks Guinness
The card only drinks Bud Light
The stack will drink anything with alcohol
They each have a Drink handler:
in the button handler:
on Drink pSomething
if pSomething is "Guinness" then
answer "the button drank it"
else
pass Drink pSomething
end if
end Drink
in the card handler:
on Drink pSomething
if pSomething is "Bud Light" then
answer "the card drank it"
else
pass Drink pSomething
end if
end Drink
in the stack handler:
on Drink pSomething
if HasAlcohol(pSomething) then
answer "the stack drank it"
else
pass Drink pSomething
end if
end Drink
The button also has a mouseUp handler:
on mouseUp
Drink field "fromBartender"
end mouseUp
(and there's also obviously a field called "fromBartender")
Now put something into the "fromBartender" field and click the button.
The button's mouseUp handler sends the "Drink" message out to see who
catches it. And do check out Richard's writeup on this. Here's a
bonus: once you get the concept of messages, everything else falls
into place pretty easily.
Saturday, September 3, 2005, 12:19:32 PM, Dan wrote:
> Great analogy.
Indeed.
--
-Mark Wieder
mwieder at ahsoftware.net
More information about the use-livecode
mailing list