MapInfo Pro Developers User Group

Welcome to the MapInfo Pro Developers community!  We are a group dedicated to the discussion and understanding of MapBasic and .Net MapInfoPro AddIn development. Bring your questions and ideas here. This group includes several members of the Pro development team from around the world.

Please feel free to start a discussion in the discussion tab or join in a conversation.

Product Information  Ideas Portal  MapInfo Community Downloads

Discussions

Members

Resources

Events

 View Only
  • 1.  How do I make a custom tab that is attached to a floating map window?

    Posted 11-07-2017 00:29

    I am writing code for a custom tab in the ribbon interface that contains buttons and tools only relevant for a map window.

    I notice that if the map window is floating, then it has three tabs, "table", "map", "spatial". Is it possible to set my custom tab to appear on the floating map window?



  • 2.  RE: How do I make a custom tab that is attached to a floating map window?

    Posted 11-07-2017 01:44

    Hi Nick,

    I wanted to give this a go myself and came up with the following.

    You have to first get the IWindowInfo object for the floating window.  I did this by retrieving the list of all windows, then looping through until I found the first document window - see below.  This assumes you already have the MapInfo object stored in global variable thisMIObject_g.

     

    Dim nWinCounter As Integer

    Dim nWinCount As Integer

    Dim bContinue As Logical

    Dim thisWindowList As This

    Dim thisWindow As This

     

    ' Get the list of windows within MapInfo:

    thisWindowList = GetWindows(thisMIObject_g)

    ' Set up the loop

    nWinCounter = 0

    nWinCount = GetWinListCount(thisWindowList)

    bContinue = True

    ' Loop through all windows

    Do While nWinCounter < nWinCount And bContinue

         ' Retrieve the current window

        thisWindow = GetWinListItem(thisWindowList, nWinCounter)

         If GetWinInfoIsDocumentWindow(thisWindow) Then

              ' This is a document window - get its ribbon

               thisRibbon = MIProGetFltingWindowRibbon(thisMIObject_g, thisWindow)

               bContinue = False

         End If

         nWinCounter = nWinCounter + 1

     Loop?

     

    Alternatively, if you know the WindowID of the floating window, you could call the WinListFromId function rather than looping through each window:

     

    thisWindow = WinListFromId(thisWindowList, nWindowID)

     

    You can then continue as you normally would with the usual ribbon - i.e. retrieve the tab collection for the ribbon:

    thisRibbonTabColl = GetTabsColl(thisRibbon)

     

    I hope this helps.

    James.



  • 3.  RE: How do I make a custom tab that is attached to a floating map window?

    Employee
    Posted 11-07-2017 12:55

    ?There is a sample app (.net) that shows how to do this that comes with mapbasic.

     

    FloatingWindowRibbon sample.