Hi Andy,
I apologize for such a delay in responding to your post, but I've been out of the office on vacation.
You are right that each legend has its own frame, so to insert legends into empty frames in a layout template you need to append the "Into ID x" clause for each Frame from Layer clause:
... Frame From Layer 1 into ID 16 Frame From Layer 3 Into ID 16, ... etc.
If you know how many legends you want to add for a map, you could add the correct number of empty frames positioned where you want them, then use Create Designer Legend to insert each legend. Or you could just use the Create Designer Legend statement to programmatically place each legend you want to add without having to insert into empty frames. This is done by adding the "Custom" keyword before you add any Frame From Layer clauses. Then each Frame From Layer clause needs to include a Position clause.
This is certainly different than the 32 bit layout. In the 32 bit layout you could insert the entire contents of a window into one frame, but the frame would clip the contents if they were too long. However, if your legend window had exactly the legends you wanted, it was a simpler way to include them at one location in a template. We have discussed alternatives but it would be great to hear back if you have any input as to how you'd want it to work.
Thanks,
Michele
------------------------------
Michele Buselli
PITNEY BOWES SOFTWARE, INC
------------------------------
Original Message:
Sent: 05-09-2019 06:28
From: Andy Bendall
Subject: Designer legend with multiple themes in Layouts issue
I'm currently working on a 64bit version of our existing 32bit mapbasic application. One aspect i'm having trouble with is with the print layouts. At the moment we provide a set of print templates that includes an empty frame where we were inserting a theme legend. This could include legends for multiple themes displayed on the map but we were able to neatly add this into a single designated frame positioned wherever the user had set the legend frame within the template.
My understanding is that its not now possible to add a theme legend window into a frame in a layout for MI v17. is that definitely the case?
As far as I can tell it looks like I should now create a Designer Legend window. The problem I'm having with this is that if there are multiple themes I am unable to insert the legends for these into the single designated frame. It appears to be much more difficult to control the positioning of multiple legends than it was in the past.
For example the code below I create a new designer legend from a map window that has 4 separate layers that include themes.
Create Designer Legend from window 3015 frame from layer 1 frame from layer 3 frame from layer 35 frame from layer 36 into ID 16
The result of this is that only the legend for layer 36 appears within my designated frame with the others appearing to the right of the layout.
If I use the below code this triggers an error because it seems that you can only use the 'into ID' if the frame is empty:
Create Designer Legend from window 3015 frame from layer 1 into ID 16 frame from layer 3 into ID 16 frame from layer 35 into ID 16 frame from layer 36 into ID 16
I see that each legend within a Designer Legend window has its own frame but is there not a way of inserting the entire Designer Legend window (incorporating all associated legend frames) into a single frame/window or globally controlling the position?
When you have a Designer Legend window open with a map window these all appear neatly inside the Legend Designer window. On a layout the legend frames appear to be more independent. The image below hopefully shows visually what I am trying to achieve:
------------------------------
Andy Bendall
System Developer
Buchanan Computing Ltd
London
------------------------------