MapInfo Pro

Expand all | Collapse all

Mapbasic to Activate specific Map window

  • 1.  Mapbasic to Activate specific Map window

    Posted 12-08-2020 16:41
    Hi All,

    I am working with MapCad tools in Mapbasic. Before I can call a tool the map window with the geometry that I am editing must be the Active or Front window.

    Ideally I'd like to select the map window by name then make that window active/front. What would be the code to achieve this?

    Thanks.

    ------------------------------
    Lee Crosby
    Campaspe Shire Council
    Echuca VIC
    ------------------------------


  • 2.  RE: Mapbasic to Activate specific Map window

    Posted 12-09-2020 03:00
    Hi Lee

    You need the ID of the window.
    If you have the name of the map, you can loop through the open windows and look for the window with that name.

    Something along these lines:

    sWinName = "Main Map"
    For nWin = 1 To NumWindows()

       nWID = WindowID(nWin)
       If WindowInfo(nWID, WIN_INFO_NAME) = sWinName Then
          Set Window nWID Front
          Exit For
       End If
    Next

    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 3.  RE: Mapbasic to Activate specific Map window

    Posted 12-09-2020 16:38
    Thanks Peter, exactly what I was after.

    ------------------------------
    Lee Crosby
    Campaspe Shire Council
    Echuca VIC
    ------------------------------