Livecode Wiki
Advertisement

Returns the top visible control at the specified location.

Built-in Function handler[]

Syntax:

controlAtLoc(loc)

Examples:

put controlAtLoc((10,10))
 put controlAtLoc("10,10")
get the name of (controlAtLoc(the mouseLoc))
if controlAtLoc("10,10") is not empty then
   put the name of controlAtLoc("10,10") into temp
   answer "In position 10,10 there is " & temp
end if

If a control is invisible, it isn't considered by controlAtLoc.

If more than one control is in the same point, only the topmost is returned.

If no control are in that position, controlAtLoc returns empty

It's recommended to check if the controlAtLoc is not empty with:

if controlAtLoc("10,10") is not empty then ...

The controlAtLoc function returns the control at the given location. The function returns the number of the control, below are examples of getting the name or long id of the control

get the name of (controlAtLoc([[location]]))
get the long id of (controlAtLoc([[location]]))

Parameters:

  • location: A location, relative to the current stack
  • Returns: The control at the given location, in the form: control control_number.

See also: location (property),

Advertisement