Purpose
Searches for map objects at a specific x/y location. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
SearchPoint( map_window_id, x, y )
map_window_id is a Map window's integer ID number
x is an x-coordinate (for example, longitude)
y is a y-coordinate (for example, latitude)
Return Value
Integer, representing the number of objects found.
Description
The SearchPoint() function searches for map objects at a specific x/y location. The search applies to all selectable layers in the Map window, even the Cosmetic layer (if it is currently selectable). The return value indicates the number of objects found.
This function does not select any objects, nor does it affect the current selection. Instead, this function builds a list of objects in memory. After calling SearchPoint(), call the SearchInfo() function to process the search results.
The search allows for a small tolerance, identical to the tolerance allowed by MapInfo Pro's Info tool. Points or linear objects that are very close to the location are included in the search results, even if the user did not click on the exact location of the object.
To allow the user to select an x/y location with the mouse, use the Create ButtonPad statement or the Alter ButtonPad statement to create a custom ToolButton. Use DM_CUSTOM_POINT as the button's draw mode. Within the button's handler procedure, call the CommandInfo() function to determine the x/y coordinates.
Example
For a code example, see the SearchInfo() function.
See Also:
SearchInfo() function, SearchRect() function