Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In MapInfo you can edit one table at a time.

How can I programmatically get the name or ID number of the table that is currently being edited?

I tried the following function:

Function GetEditableTable as String
  Dim i, j, WinID as integer
  Dim TableList() as String
  i = NumTables()
  ReDim TableList(i)

  WinID = FrontWindow()
  For j = 1 to i
    Note LayerInfo(WinID, j, LAYER_INFO_EDITABLE)
    If LayerInfo(WinID, j, LAYER_INFO_EDITABLE) = TRUE Then
      GetEditableTable = TableInfo(j, TAB_INFO_NAME)
      Exit Sub
    End If
End Function

...but it returns the same table name no matter which table is editable.

share|improve this question
up vote 1 down vote accepted

I use a function like this:

Function MAPGetEditLayerName(ByVal nMID As Integer) As String

Dim nEditLayerID As Integer

MAPGetEditLayerName = ""

    nEditLayerID    = MapperInfo(nMID, MAPPER_INFO_EDIT_LAYER)
    Do Case nEditLayerID
        Case -1
            '**No editable layer currently
        Case 0
            '**The cosmetic layer is currently editable
            MAPGetEditLayerName = LayerInfo(nMID, nEditLayerID, LAYER_INFO_NAME)
        Case Else
            MAPGetEditLayerName = LayerInfo(nMID, nEditLayerID, LAYER_INFO_NAME)
    End Case

End Function

One problem with your function is that you loop over the number of open tables and not the number of layers in the map.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.