getting started with the ribbon library in the 64-bit version of mapinfo pro v 12.5
TRANSCRIPT
![Page 1: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/1.jpg)
Getting started with the Ribbon Library
Peter Horsbøll MøllerMarch 2015
![Page 2: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/2.jpg)
This will help you getting started with the Ribbon Library to develop MapBasicapplications for the new ribbon based MapInfo Pro 64 bit.
![Page 3: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/3.jpg)
Prerequisites:
Download and install:- MapInfo Pro 12.5 64 bit
Get it >>>- MapBasic 12.5.1
Get it >>>
![Page 4: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/4.jpg)
Get the Ribbon Library
You can get the Ribbon Library from:
Github.com:• https://github.com/PeterHorsbollMoller/mbRibbonExample
Community Download:• http://communitydownloads.pbinsight.com/code-exchange/download/ribbon-
library-for-mapbasic
![Page 5: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/5.jpg)
Unzip the Ribbon Library
Sample Application
Sample tables
Icons for the ribbon
Full source code
![Page 6: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/6.jpg)
Running the RibbonExample
![Page 7: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/7.jpg)
”How can I use the Ribbon Library in my own MapBasic project?
![Page 8: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/8.jpg)
Create a new file structure
Create a new base folder
Create a sub folder for your MapBasic source code
Base folder
Source code
![Page 9: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/9.jpg)
Create a file structure
Copy the Library folder from the RibbonExample to your source codefolder
Base folder
Source code
Library
![Page 10: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/10.jpg)
Use your preferred text editor to create a new Mapbasic source code file for your application
Save it to the mbcode folder as type .mb, eg. MyFirstRibbonApp.mb
Insert these lines as a start:
Compile with MapBasic 12.5.1
Create a main source code file (.mb)
Include the RibbonLib header file
Include some MapBasic header files
Will show the new Notification
![Page 11: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/11.jpg)
Use your text editor to create a new Mapbasic Project file for your application
Save it to the mbcode folder as type .mbp, eg. MyFirstRibbonApp.mbp
Insert these lines as a start:
Link with MapBasic 12.5.1
Create a MapBasic Project file (.mbp)
Name of final MapBasic application
Compiled libraries to be included
Your compiled module
![Page 12: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/12.jpg)
Run the application in MapInfo Pro x64
![Page 13: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/13.jpg)
Adding an EndHandler
To make sure your application tidy up after itself, add an EndHandler to your application
Call the EndHandler of the RibbonLib
![Page 14: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/14.jpg)
”How do I create a new Tab and adda Group to it?”
![Page 15: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/15.jpg)
Add a new Tab to the Ribbon
1. Check if the Tab already exists2. If not, add it
Adding the new Tab
Does it already exist?
![Page 16: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/16.jpg)
Run the application in MapInfo Pro x64
![Page 17: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/17.jpg)
1. Check if the Group already exists2. If not, add it
Add a Group to the Tab
Adding the new Group
Does it already exist?
![Page 18: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/18.jpg)
Run the application in MapInfo Pro x64
![Page 19: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/19.jpg)
How do I add a Button to my new Group?
![Page 20: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/20.jpg)
Adding a button to a group
First you add a new button to the group
Then you set the look and behaviour of the button, such as caption, tooltips and icon
Modular level arrays
Adding a new button
Defining its look and
behaviour
Getting its Control ID for
later use
![Page 21: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/21.jpg)
The handler of the button
This handler is designed to manage several buttons calling it as it determines the ID of the button clicked by the user
Get the ID and calculate
the item number
Now do the work
Requires MAPPERLib
![Page 22: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/22.jpg)
Adding the MAPPERLib module
Include the header file in your source code
And include the compiled module in your MapBasic project file
Include MAPPERLib.def
Include MAPPERLib.mbo
![Page 23: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/23.jpg)
Run the application in MapInfo Pro x64
![Page 24: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/24.jpg)
Adding multiple buttons
Add more elements to
the arrays
Loop the elements
![Page 25: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/25.jpg)
Run the application in MapInfo Pro x64
![Page 26: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/26.jpg)
What about splitbuttons? Can I create these, too?
![Page 27: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/27.jpg)
Add a SplitButton with a SplitButtonGroup
I’m adding a new SplitButton control
I’m setting the icon of the SplitButton to match the icons of the first button I’lladd to it later
And I’m setting the handler of the SplitButton to match the handler of the first button, too
Finally I add a SplitButtonGroupAdding the SplitButton
Adding a SplitButtonGroup
Set icons
Set handler
![Page 28: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/28.jpg)
Adding buttons to the SplitButtonGroup
And then we add the buttons to the SplitButtonGroup
This is similar to adding buttons to a Group on a Tab
Adding the Buttons
Specify icons,
tooltips and
handlers
ControlID – needed in the handler
![Page 29: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/29.jpg)
The handler/subprocedure
The the ID of the control
Did the user use the initial
button or did he select one
from the list?
![Page 30: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/30.jpg)
Run the application in MapInfo Pro x64
![Page 31: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/31.jpg)
”How can I easily add the standard buttons to the Tools window?”
![Page 32: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/32.jpg)
Tool Manager – Addin procedures
Each tool can publish information
Sub •AddIn_About•AddIn_Help•AddIn_DefaultCommand
Function •AddIn_Name()•AddIn_Description()•AddIn_Version()•AddIn_ImageUri()
Help File Aboutbox End
Description
Version
Image
Name
Default Command
activated thru
double click
![Page 33: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/33.jpg)
The ProgramInfo module
These standard subprocedures and functions have been added to the ProgramInfo module
Include the header file for this module in your application module
Include the ProgramInfo.def file
![Page 34: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/34.jpg)
Configure the ProgramInfo module
Specify the values for ProgramInfo to use in the dialogs
You can use the functions from ProgramInfo to get to the values, such as the application name via PRGIGetApplicationName()
Specifying values for
ProgramInfo
Use functions from ProgramInfo
to get to the values
![Page 35: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/35.jpg)
Include compiled modules in your project
You need to include several extra compiled modules in the MapBasicproject file
Reading/writing configuration files
Managing files and folders
Working with map windows
Aboutbox and programinformation
Aboutbox and programinformation
Working with strings
![Page 36: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/36.jpg)
Run the application in MapInfo Pro x64
![Page 37: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/37.jpg)
”Can I use my own images on the buttons?”
![Page 38: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/38.jpg)
Using custom images
You can refer to internal MapInfo images, see the MapBasic User Guide, Glossary, List of Embedded images for a list of all images
You can also refer to individual image files on disk, eg. in a sub folder of the application directory
Internal MapInfo image
Image file on disk
![Page 39: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/39.jpg)
Defines for Internal images
I have created defines for the internal images of MapInfo Pro 64 bit in a file called MI_ICONS_X64.def.
The file is included in the source code for this sample application in the Library folder and it will also be included with the RibbonLibrary Sample Application later.
![Page 40: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/40.jpg)
”Are you sharing the source code for this sample application?”
![Page 41: Getting Started with the Ribbon Library in the 64-bit version of MapInfo Pro v 12.5](https://reader034.vdocuments.us/reader034/viewer/2022051400/55a629021a28abca138b4655/html5/thumbnails/41.jpg)
Get the source code for the sample application
I have shared the source code on the Danish Pitney Bowes Software blog.
Get it here:http://blogs.pitneybowes.dk/files/2015/03/MyFirstRibbonApp.zip
Have fun!