the target

Peter Haworth pete at lcsql.com
Sat Sep 15 20:07:20 EDT 2012


What Mike said.  I found this confusing at first but just think of it being
true until another engine message is generated, then that message rests the
target.

So if the button on your first card had a mouseUp script that called your
handler "xyz", then "xyz" would report your button as the target.  If "xyz"
in turn called another of your handlers named "abc", then it too would
report your button as the target.

Another little gotcha, if memory serves me right, is when using behaviors.
 In a behavior script, "me" will get you a reference to the control that
caused the behavior to fire.

And just give you something else to remember, in a combobox script, "me"
refers to the button part of the combobox and the target refers to the
field part of it.

Pete
lcSQL Software <http://www.lcsql.com>



On Sat, Sep 15, 2012 at 4: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