MapInfo Pro Developers User Group

Expand all | Collapse all

How to retrieve the name of the tables in a Map frame (Layout) ?

  • 1.  How to retrieve the name of the tables in a Map frame (Layout) ?

    Posted 11-18-2019 10:55
    Hi there,

    I had developed a MapBasic app (v12) to automatically fill in the title of a Layout template, based on the name of a table included in the Map frame. Unfortunately, it no longer works with MapInfo pro 17 since the Layout logic has completely changed.

    So, how could we manage to get the name of the tables included in the layout Map frame ?

    Thanks for the help,

    j.

    ------------------------------
    Joe Chester
    Knowledge Community Shared Account
    ------------------------------


  • 2.  RE: How to retrieve the name of the tables in a Map frame (Layout) ?

    Posted 11-19-2019 18:39
    Edited by Kalu Ribush 11-19-2019 18:49


    Hi

    Assuming you've only got one Mapper frame on the Layout window, the code below should work. Layer Names will be saved in array " arrayListLayers()":


    '*******************************************************************************
    dim arrayListLayers() as string
    dim k, intNumberOfLayer, intSelectedMapperWinID, intSelectedLayoutWinID as integer


    ' loop through frames on Layout to find mapper frame ID
           For k = 1 to LayoutInfo(intSelectedLayoutWinID,LAYOUT_INFO_NUM_ITEMS)
                  If LayoutItemInfo(intSelectedLayoutWinID,k,LAYOUT_ITEM_INFO_TYPE) = LAYOUT_ITEM_TYPE_MAPPER then
                       intSelectedMapperWinID = LayoutItemInfo(intSelectedLayoutWinID,k,LAYOUT_ITEM_INFO_WIN) 'get mapper frame id
                  End If
           Next

          intNumberOfLayer = MapperInfo(intSelectedMapperWinID,MAPPER_INFO_LAYERS)

          redim arrayListLayers(intNumberOfLayer)

          For k = 1 to intNumberOfLayer
                arrayListLayers(k) = LayerInfo(intSelectedMapperWinID,k,LAYER_INFO_NAME)
          Next


    ------------------------------
    Kalu Ribush
    Senior Mapping Specialist
    Department of Economic Development, Jobs, Transport and Resources (DEDJTR)
    Melbourne
    ------------------------------



  • 3.  RE: How to retrieve the name of the tables in a Map frame (Layout) ?

    Posted 11-20-2019 02:58
    Hi and thanks for the help.

    It's not always easy to know which to use between LAYOUT_INFO, LAYOUT_ITEM, WIN_INFO, MAPPER_INFO..., now it makes more sense. I will try your code.

    Best

    Joe

    ------------------------------
    Joe Chester
    Knowledge Community Shared Account
    ------------------------------