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 2Of 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
------------------------------
Original Message:
Sent: 02-21-2019 11:06
From: David Wilson
Subject: How to update a Layout Frame with a Designer Legend
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
------------------------------