send mouseup to control

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
capellan
Posts: 415
Joined: Wed Aug 15, 2007 11:09 pm
Contact:

send mouseup to control

Post by capellan » Wed May 24, 2017 6:12 pm

Hi All,

Reading LiveCode Dictionary about the target and send,
could not find an obvious way to get the name of a message
sender without putting first this name in another container
(a custom property, a field or a global variable).

Why do I need to know which control send a message
to another control?

Because the handler in the control executes different code
depending of which control sends it a mouseup handler.

For now, I am using a mouseup button parameter that
could be 1 or 2 or 3. If the control receive a mouseup with
parameter 1, then executes handler 1. If the mouseup is
received with a parameter 2 then control executes
handler 2.

Which other ways could I use to produce the same result?

Al

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 2089
Joined: Fri Feb 19, 2010 10:17 am
Location: Bulgaria
Contact:

Re: send mouseup to control

Post by richmond62 » Wed May 24, 2017 6:52 pm

wdi.png
customProps
Who Did It.livecode.zip
Here's the stack.
(19.67 KiB) Downloaded 40 times
Click on all 3 buttons and the picture to see what messages you get :)

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5541
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: send mouseup to control

Post by FourthWorld » Wed May 24, 2017 7:31 pm

The executionContexts is a good way to get any part of the calling chain. For the item in question, try:

Code: Select all

function CallerID
   -- Line -1 = this function
   -- Line -2 = the script that called this function
   -- so:
   return item 1 of line -3 of the executionContexts
end CallerID
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4070
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: send mouseup to control

Post by jacque » Thu May 25, 2017 6:47 pm

I generally just use "the name of the target" or "the short name of the target", depending on whether I need the object identifier included.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 5541
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: send mouseup to control

Post by FourthWorld » Thu May 25, 2017 7:46 pm

Doesn't the target change with "send"?
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 4070
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: send mouseup to control

Post by jacque » Thu May 25, 2017 8:07 pm

FourthWorld wrote:Doesn't the target change with "send"?
Yes, I missed that part. I read the OP as considering the two terms separately rather than in tandem.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply

Return to “Talking LiveCode”