On MouseUp with a parameter question

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
chipsm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 244
Joined: Wed May 11, 2011 7:50 pm

On MouseUp with a parameter question

Post by chipsm » Mon May 29, 2017 2:56 pm

When I use the following code, what actually happens?

This is the code for a button object:

on MouseUp pBtnNum
--answer pBtnNum
if pBtnNum = 3 then answer "ok"
end MouseUp

I am assuming that by adding the parameter pBtn to the “on MouseUp” command that this allows me to access the pBtn in the script.
This parameter is different for buttons vs. fields.

The results were:
Left Click :nothing
Right Click : Message box

This is the script for a field object:
on mouseUp pBtn
answer pBtn
end mouseUp

The results were:
Left Click : nothing
Right Click : message box with the number 3

I am just trying to understand this and I can’t seem to find documentation about this.
Clarence Martin
chipsm@themartinz.com

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: On MouseUp with a parameter question

Post by Klaus » Mon May 29, 2017 3:02 pm

Hi Chips,

other than buttons and other LC objects, un-locked fields only receive RIGHT-clicks -> pBtn = 3
and no "normal" (left) mouse-messages.


Best

Klaus

chipsm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 244
Joined: Wed May 11, 2011 7:50 pm

Re: On MouseUp with a parameter question

Post by chipsm » Mon May 29, 2017 3:14 pm

Thanks Klaus.
When I add a parameter to an object, does this initiate a change in the message path that allows the detection of the parameter?
Clarence Martin
chipsm@themartinz.com

Klaus
Posts: 14208
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: On MouseUp with a parameter question

Post by Klaus » Mon May 29, 2017 3:50 pm

Sorry, no capisce, can you give an example?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10350
Joined: Wed May 06, 2009 2:28 pm

Re: On MouseUp with a parameter question

Post by dunbarx » Mon May 29, 2017 4:44 pm

Adding parameters to a message does not change the message path. Parameters only carry additional information. The are read by the receiving handler in the order they are passed, usually named (or renamed) at the first line of the handler itself, and used inside that handler from that point on.

So, in the simplest possible case:

Code: Select all

on mouseUp
   double 44
end mouseUp

on double tNumber
   answer tNumber * 2
end double
Craig Newman

chipsm
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 244
Joined: Wed May 11, 2011 7:50 pm

Re: On MouseUp with a parameter question

Post by chipsm » Mon May 29, 2017 5:02 pm

Thanks Craig.
Clarence Martin
chipsm@themartinz.com

Post Reply