MapInfo Pro Developers User Group

Expand all | Collapse all

Map layout

  • 1.  Map layout

    Posted 01-15-2020 09:53
    When trying to open a workspace and creating the first layout it is working but when I create the second layout, MapInfo keeps crashing. Anyone knows why?

    This is the code I wrote:

    Dim lnNewWin As Integer Dim lnNewWin As Integer
    ' 8 x 11 P If ((InStr(1, lcFormat, "8.5") > 0) And (InStr(1, lcFormat, "Landscape") = 0)) Then
           Run Application "J:\GeoApps\MapLayouts\8X11P\" + tcFileName
           lnNewWin = FrontWindow()

          Set Layout Window lnNewWin Frame Contents Off

         loFrame = StampMapWindow(lnNewWin, lnWinExist, lcFormat, 0.7479, 1.1167, 7.7417, 8.2007)
         Call ReScaleMaps(lnNewWin, lnWinExist, loFrame, lcMapUnit, lnScale, 0.7479, 1.1167, 7.7417, 8.2007)
         Call StampJobNumber(lnNewWin, 0.7535, 10.3701)
         Call StampSiteInfo(loCenter, lnNewWin, 3.4646, 8.2382, tnSource, tlQuad)
         Call StampNorthArrow(lnNewWin, 6.9375, 8.7000)
         Call StampScale(lnNewWin, lnWinExist, lnScale, 6.0965, 9.3625)

    If (tlStampSymbols) Or (tlOnlyTP) Then
         Call StampSymbols(lnNewWin, 0.8653, 8.3090, 9.0, lcProperty, tlOnlyTP)
    End If

    If (tlFEMAMap) and (tcFileName) = "Fema.wor" Then
          Call StampFEMAInfo(lnNewWin, 5.0000, 8.2375)
    End If

    If (tcFileName) = "NWI.wor" Then
           Call StampNWIInfo(lnNewWin, 6.7500, 8.2375)
    End If

    Set Window FrontWindow() Tabbed Printer Name "Adobe PDF" Orientation Portrait Copies 1 Papersize 1

    ------------------------------
    Michel Li
    Programmer
    GEOSEARCH LLP
    Austin TX
    ------------------------------


  • 2.  RE: Map layout

    Posted 01-16-2020 03:21

    Hi Michel

    Where does it crash? Have you tried adding a few Note statements in between your procedure calls to identify where it crashes?

    It's not even sure that the crash is caused by this code. It could also happen in one of the subprocedures.

    I can't see anything obvious that could explain a crash.

    I doubt this could do it but I'd recommend changing this line:

    Set Window FrontWindow() Tabbed Printer Name "Adobe PDF" Orientation Portrait Copies 1 Papersize 1

    to

    Set Window lnNewWin Tabbed Printer Name "Adobe PDF" Orientation Portrait Copies 1 Papersize 1



    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 3.  RE: Map layout

    Employee
    Posted 01-16-2020 08:43
    Yes, some print or note statements should help you track this down. You need to confirm what window InNewWin is set to (after using these statements):

           Run Application "J:\GeoApps\MapLayouts\8X11P\" + tcFileName
           lnNewWin = FrontWindow()

    It's possible that InNewWin is a map frame in a layout from the WOR and not the Layout window ID. To help figure out what is going on, try printing out the window ID and its type, such as:

       note "InNewWin = " + inNewWin + "  type = " + WindowInfo(InNewWin, 3)
    or
      print "InNewWin = " + inNewWin + "  type = " + WindowInfo(InNewWin, 3)

    ------------------------------
    Alicia Levesque
    Pitney Bowes Software
    ------------------------------



  • 4.  RE: Map layout

    Posted 01-16-2020 11:11
    Thank you Peter and Alicia it looks like it is working now. What I did was save the workspace with tabbed in and it worked.

    ------------------------------
    Michel Li
    Programmer
    GEOSEARCH LLP
    Austin TX
    ------------------------------