MapInfo Pro

 View Only
  • 1.  How to update a Layout Frame with a Designer Legend

    Posted 02-21-2019 11:07
    Hi,
    We have  number of workspaces used for printing that can open the new style designer layouts with pre-positioned frames. These then get updated via MapBasic for  map, or text objects.
    Such as
    for the main map window:
     Set Designer Frame window layout_id ID gMapper_Frame_ID from window main_mapper_id 
    For text frame window
    alter designer text window layout_id ID iTextFrame Text snewtext

    But if I've previously created a legend via the 'Create Designer Legend' command, it creates a new window with the legend, but I can't then update a prepositioned frame with that legend, they can only be updated from map or browser windows.
    How can I copy the Designer Legend into a frame on the Designer Layout using MapBasic or without actually re-running the 'create designer legend' commands? Its possible that more than one layer would have either had a legend or thematic map generated prior to the layout workspace being opened.
    Thanks
    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------


  • 2.  RE: How to update a Layout Frame with a Designer Legend

    Posted 02-21-2019 12:57
    Hi David,
    The only way to insert a legend into an empty frame on the Layout is to run 'Create Designer Legend' and tack on the 'Into Id' clause for each 'Frame From Layer' clause.   It sounds as if you've already figured this out, but for example, if the Map window Id on the current page of the Layout is 3131 you can type this into the MapBasic window to select a layer legend and insert it into empty frame Id 2. 

    Create Designer Legend From Window 3131 Portrait Default Frame Style "#" Font ("Arial",0,8,0) Frame From Layer 2 Into Id 2

    Of course, there's more to the 'Create Designer Legend' statement to customize what the legend looks like.  You can also select an empty frame, and as long as there is a map on the current page, select the Legend button from the LAYOUT ribbon and insert a legend using the Create Legend wizard. 

    You can get legends from a Legend Designer window to be copied into a Layout using the Layout Template add-in, but it is limited in how it works. For example,  create a Layout that has a map and 3 legends. Save it as a template. The template will have an empty map frame, and 3 empty legend frames.  Let's say you open a workspace with a single Map window and a Legend Designer window with a theme legend, and perhaps another legend. When you open the template you just created, Pro will auto-fill the map frame with the Map window, and try to auto-fill up to 3 legends from the  Legend Designer window.  But if you have more than one Map window open we don't try to auto-fill anything. 

    Hope this helps.

    ------------------------------
    Michele Buselli
    PITNEY BOWES SOFTWARE, INC
    ------------------------------



  • 3.  RE: How to update a Layout Frame with a Designer Legend

    Posted 02-22-2019 03:50
    Thanks Michele,
    I think my trouble is that we create a legend or thematic layer whilst 'viewing' the map. We then open our workspace to do a print layout and now that the 'layout map' is not linked to the original map window, we would have to recreate the legend based upon that new window, so the window ID will have changed.
    You can only get a legend frame created onto a layout if you reference the map window in that layout.
    Also the 'Into' clause still only works on inserting into a blank 'legend' frame it will not work on a normal frame.
    I'll have a look into the new 'Template' process but earlier these were only linked to each pc and couldn't be stored on servers, it's possibly changed in v17.0.2
    Cheers
    David

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------



  • 4.  RE: How to update a Layout Frame with a Designer Legend

    Posted 02-22-2019 06:12
    I've also just realised the old code that used to add a frame from the WIN_LEGEND window doesn't work in 64bit.
    So:
    Create Frame into Window 3018 (22.479,9.67846)(28.5785,15.6792) Title "Theme Legend of MAP1" FillFrame On Name "LEGEND2"

    No longer works, it doesn't give any error message but doesn't show the frame.
    Was this intended as it's still shown in the Help that this can be added.

    ------------------------------
    David Wilson
    Buchanan Computing
    London, UK
    ------------------------------



  • 5.  RE: How to update a Layout Frame with a Designer Legend

    Posted 02-22-2019 10:42
    For a while, both the 32-bit and 64-bit Layouts co-existed; the reason commands like this one are still in the Help. We do have a back log item to review and update the documentation and it includes Create Frame.  It is MIPRO-97803 if you want to track it.

    ------------------------------
    Michele Buselli
    PITNEY BOWES SOFTWARE, INC
    ------------------------------