That helps, Martin.
The logo I would suggest you add to the template.
You calculated variables, I'd suggest access using smart text elements that you also add to the template. Let me show you how below.
In your application, that I expect will be running when they use the Layout Template, you create one or more functions that you publish to/register with MapInfo Pro using the IMBXRegisterPublicFunction method declared in IMapInfoPro.def. If you are using the RibbonLib, you can use RBNRegisterFunctionAsPublic.
Now when you run your application this or these functions of your are available to the MapInfo Pro user, and to MapInfo Pro.
This means you can use your function in a SmartText: $mb{MyFancyFunction("SomeParameter")}
Your function can return a single word/number or it can return a longer text string with newline characters.
I have described this in a bit more detail here:
Smart text in Layout Automation.
Alternatively, you can have a look at the source code for the Layout Template tool and mimic what this tool does when opening a Layout Template. You can find it in the Samples folder in your MapBasic installation folder: Samples\RIBBONINTERFACE\DotNet\LayoutTemplate..
------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Precisely | Trust in Data
------------------------------
Original Message:
Sent: 08-26-2020 04:31
From: Martin Hodder
Subject: Layout Templates
Hi Peter,
Thanks for the reply as always.
What I am trying to achieve is for the user to press a button and the layout gets automatically created. So put in the map and add the logo and add the information that my program has calculated and held in variables.
In the past would create workspaces with just the the layout - the program would open the workspace and populate it.
I was hoping the user they could edit a template to their own design and allow them to use the smart text. Then the program would open the template and add in the information from the program - all by a single press of a button.
Does that help clarify what I am trying to do?
------------------------------
Martin Hodder
Managing Consultant
Higher Mapping Solutions (OEM)
Original Message:
Sent: 08-26-2020 03:47
From: Peter Horsbøll Møller
Subject: Layout Templates
Hi Martin
I might be missing the point but you can "use" the layout template and modify it through the standard tools in MapInfo Pro. Once you have emoade the edits, you can save the layout back as a Layout Template.
Is that what you are looking for?
------------------------------
Peter Horsbøll Møller
Distinguished Engineer
Precisely | Trust in Data
Original Message:
Sent: 08-25-2020 09:25
From: Martin Hodder
Subject: Layout Templates
Hi Everyone,
Has anyone worked out how to open layout templates through Mapbasic?
I can find where they are stored and the .lay seems to be the Mapbasic code to create the layout.
I can of course just write the whole layout in MB but I wanted to allow the user and easy editing option through templates.
Any help would be great
many thanks
Regards
------------------------------
Martin Hodder
Managing Consultant
Higher Mapping Solutions
------------------------------