Page 1 of 1
Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 3:26 am
by Cheong
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?
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 3:43 am
by dunbarx
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
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 4:44 am
by FourthWorld
Spoiler: target
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 6:04 am
by Cheong
Thanks Craig Newman and FourthWorld,
Target works perfectly.
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 10:48 am
by richmond62
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.
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 5:53 pm
by jacque
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?
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 10:19 pm
by dunbarx
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
Re: Detect the name control/object name by clicking on it
Posted: Wed Nov 18, 2015 11:41 pm
by SparkOut
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