the target

Mike Bonner bonnmike at gmail.com
Sat Sep 15 19:22:04 EDT 2012


The target where the MOUSEUP originated is the button. The target that
recieved the opencard is the card, so the opencard handler reports that.

If you change your source button handler to
go stack "test"
pass mouseup

Then add a mouseup handler to the card script of the mainstack

on mouseup
  put the target
-- reports button "source"  because its the same message going through the
path, and button "source" was the original recipient
end mouseup

On Sat, Sep 15, 2012 at 5:09 PM, Mark Smith <Mark_Smith at cpe.umanitoba.ca>wrote:

> I have a question about "the target"
>
> According to the docs "Returns the object which received the message that
> started execution."
>
> And "Use the target function within a message handler to determine which
> object originally received the message."
>
> So why, when I do the following, does it return "card "destination"" as the
> target and not "button "source"" ?
>
>
> 1. Create a new mainstack, call it mainstack
> 2. Add a button, call it source
> 3. add script to source: on mouse up
> go stack test
> 4. add a substack, call it test
> 5. name the card destination
> 6. Add a script to the card:
> on opencard
> put return & the target after msg
>
> 6. Add a button, call it close
> 7. Add the following script:
> on mouseup
> close this stack
>
> Click on the Source button. It does not report btn "source" as the target.
> Instead it
> reports card "destination" as the target? It would seem to me that the
> object that received the message that started execution was the button? I
> don't see how the card gets in there as a target at all.
>
> Thanks
>
> PS also, I presume the docs have some kind of error in them? I tried
> targettarget() but the compiler flags it as an error
>
> Best,
>
> -- Mark
>
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/the-target-tp4655052.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



More information about the use-livecode mailing list