Mouse down on a field

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Mouse down on a field

Post by francof » Mon Jul 28, 2014 5:36 pm

ciao all,

I've 10 grouped text fields, I would like to put the text of the one clicked into another field. it's possible to do without repeat the code of handler mouseDown of each field.

thanks
franco

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

Re: Mouse down on a field

Post by jmburnod » Mon Jul 28, 2014 5:50 pm

Hi Franco,
it's possible to do without repeat the code of handler mouseDown of each field
Yes :D
Put your mousedown handler in your group script
You can use also "behavior"
Best regards
Jean-Marc
https://alternatic.ch

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

Re: Mouse down on a field

Post by dunbarx » Mon Jul 28, 2014 7:33 pm

Hi.

Please check out the "target" function in the dictionary. It will amaze you. I am sure you can take it from there, also using Bernd"s suggestion about placing your handler in the group script.

Craig Newman

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: Mouse down on a field

Post by francof » Mon Jul 28, 2014 7:52 pm

HI Jean-Marc, Craig
yes me too was thinking about to put code in the group script, the problem was what code............. answer target is the solution.

many thanks
franco

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

Re: Mouse down on a field

Post by dunbarx » Mon Jul 28, 2014 8:35 pm

Hi.

For your original question:

Code: Select all

Put the value of the target into fld "yourOtherField"
Or even better:

Code: Select all

Put target into fld "yourOtherField"
Now you must go back to the dictionary and tell us what the difference is between the function "the target" and the keyword "target" is.

Craig

francof
Posts: 237
Joined: Fri Apr 11, 2014 10:51 am

Re: Mouse down on a field

Post by francof » Tue Jul 29, 2014 8:22 am

dunbarx wrote: ...
Now you must go back to the dictionary and tell us what the difference is between the function "the target" and the keyword "target" is.

Craig
yes I saw, I've used the keyword "target" because my need is to show the contents of the clicked field. quote from the Dictionary:
"Specifies the text contents of the field which was the target of the message currently being handled." and more:
"Use the target keyword to access the contents of the field named in the target function."

while the function "the target" "Returns the object which received the message that started execution." and could be used to make actions and events with that object.
so I've understood

franco

P.S.:
I've used "Answer" because it is an automatic window, open and close in a line of code
f

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

Re: Mouse down on a field

Post by dunbarx » Tue Jul 29, 2014 1:33 pm

Franco.

Exactly so. These are so powerful and convenient.

Craig

Post Reply