Detect the name control/object name by clicking on it

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
Cheong
Posts: 30
Joined: Tue Oct 27, 2015 7:49 am

Detect the name control/object name by clicking on it

Post by Cheong » Wed Nov 18, 2015 3:26 am

Hi readers,

Is it possible to detect the name of the object/control name in group when the user click on it? (Not a button, but such as images, field and etc.)
Can I use the result as a variable?
Any idea?

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

Re: Detect the name control/object name by clicking on it

Post by dunbarx » Wed Nov 18, 2015 3:43 am

Cheong.

Yes.

You are asking questions which a new user by rights ought to ask himself. The questions themselves are sound, but they are ones that should be asked along the path of learning LiveCode. This takes time effort and a bit of dedication. Start with the user guide and:
http://www.hyperactivesw.com/revscriptc ... rences.htm

Continue asking here, but at the same time experiment as much as possible with any task you can think of. Even a trivial stack will require considerable coding effort, especially when you try to increase or change functionality.

And oh yes, think about this: "answer the name of the target" Does it make sense to you that you would put this in either the group or card script?

Craig Newman

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Detect the name control/object name by clicking on it

Post by FourthWorld » Wed Nov 18, 2015 4:44 am

Spoiler: target
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Cheong
Posts: 30
Joined: Tue Oct 27, 2015 7:49 am

Re: Detect the name control/object name by clicking on it

Post by Cheong » Wed Nov 18, 2015 6:04 am

Thanks Craig Newman and FourthWorld,

Target works perfectly.

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Detect the name control/object name by clicking on it

Post by richmond62 » Wed Nov 18, 2015 10:48 am

I prefer to use

tooltips

for finding out names of objects, then you
don't have any problems if you want to use
mouseUp or mouseDown to execute scripts.

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7393
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Detect the name control/object name by clicking on it

Post by jacque » Wed Nov 18, 2015 5:53 pm

How would a tooltip help a handler determine the name of the target, and how does "target" interfere with mouse events? Also, do you turn off tooltips to avoid the constant visual interference during use?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

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

Re: Detect the name control/object name by clicking on it

Post by dunbarx » Wed Nov 18, 2015 10:19 pm

Jacque.

Too bad the toolTip field cannot evaluate strings: 'the name of me".

Remember the power that HC's report utility had, where you could load a custom function?

Craig

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Detect the name control/object name by clicking on it

Post by SparkOut » Wed Nov 18, 2015 11:41 pm

The tooltip contents can't evaluate "the name of me" but you can set the tooltip dynamically by script at a suitable moment, such as

Code: Select all

on mouseEnter
  set the tooltip of me to the name of me
end mouseEnter

Post Reply