Purpose
Initializes an internal label pointer, so that you can query the label for a specific row in a map layer. You can call this function from the MapBasic window in MapInfo Pro.
Syntax
LabelFindByID( map_window_id, layer_number, row_id, table, b_mapper )
map_window_id is an integer window id, identifying a Map window.
layer_number is the number of a layer in the current Map window (for example, 1 for the top layer).
row_id is a positive integer value, indicating the row number of the row whose label you wish to query.
table is a table name or an empty string (""): when you query a table that belongs to a seamless table, specify the name of the member table; otherwise, specify an empty string.
b_mapper is a logical value. Specify TRUE to query the labels that appear when the Map is active; specify FALSE to query the labels that appear when the map is inside a Layout.
Return Value
Logical value: TRUE means that a label exists for the specified row.
Description
Call LabelFindByID() when you want to query the label for a specific row in a map layer. If the return value is TRUE, then a label exists for the row, and you can query the label by calling the LabelInfo() function.
Example
The following example maps the World table, displays automatic labels, and then determines whether a label was drawn for a specific row in the table.
Include "mapbasic.def"
Dim b_morelabels As Logical
Dim i_mapid As Integer
Dim obj_mytext As Object
Open Table "World" Interactive As World
Map From World
i_mapid = FrontWindow()
Set Map Window i_mapid Layer 1 Label Auto On
' Make sure all labels draw before we continue...
Update Window i_mapid
' Now see if row # 1 was auto-labeled
b_morelabels = LabelFindByID(i_mapid, 1, 1, "", TRUE)
If b_morelabels Then
' The object was labeled; now query its label.
obj_mytext = LabelInfo(i_mapid, 1, LABEL_INFO_OBJECT)
' At this point, you could save the obj_mytext object
' in a permanent table; or you could query it by
' calling ObjectInfo() or ObjectGeography().
End If
See Also:
LabelFindFirst() function, LabelFindNext() function, LabelInfo() function