SlideShare une entreprise Scribd logo
1  sur  58
Getting started with the Ribbon Library
Peter Horsbøll Møller
November 2016
This will help you getting
started with the Ribbon
Library to develop MapBasic
applications for the new
ribbon based MapInfo Pro 64
bit.
Prerequisites:
Download and install:
- MapInfo Pro 16.0 64 bit
- MapBasic 16.0
The Ribbon library is a
custom made MapBasic
module which is part of
the broader mbLibrary.
It makes it easier to
integrate the most
common controls into the
Ribbon using MapBasic.
Get the MapBasic Library - mbLibrary
You can get the MapBasic Library from Github.com:
Github.com:
• https://github.com/PeterHorsbollMoller/mbLibrary
Get the Ribbon Example Application
You can get the Ribbon Example Application from:
Github.com:
• https://github.com/PeterHorsbollMoller/mbRibbonExample
Community Download:
• http://communitydownloads.pbinsight.com/code-exchange/download/ribbon-
library-for-mapbasic
Unzip the Ribbon Library
Sample Application
Sample tables
Icons for the ribbon
Full source code
Running the RibbonExample
”How can I use the Ribbon Library in
my own MapBasic project?
Create a new file structure
Create a new base folder
Create a sub folder for your MapBasic source code
Base folder
Source code
Add the mbLibrary modules
Copy the Library folder from the RibbonExample to your source code
folder
Or better: Copy the files and folders from the folder mbLibrary from
the MapBasic Library to the Library folder here
Base folder
Source code
Library
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:
Create a main source code file (.mb)
Include the RibbonLib header file
Include some MapBasic header files
Will show the new Notification
Adding an EndHandler
To make sure your application tidy up after itself, add an EndHandler to
your application
Compile with MapBasic 16.0
Call the EndHandler of the RibbonLib
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 16.0
Create a MapBasic Project file (.mbp)
Name of final MapBasic application
Compiled libraries to be included
Your compiled module
Run the application in MapInfo Pro x64
”How do I create a newTab and add
a Group to it?”
Add a newTab to the Ribbon
1. Check if theTab already exists
2. If not, add it
Adding the new Tab
Does it already exist?
Internal name of the tab
Caption of the tab, shown on the ribbon
Run the application in MapInfo Pro x64
1. Check if the Group already exists
2. If not, add it
Add a Group to theTab
Adding the new Group
Does it already exist?
Internal name of the group
Caption of the group, shown on the ribbon
Run the application in MapInfo Pro x64
How do I add a Button to my new
Group?
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
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
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
Run the application in MapInfo Pro x64
Adding multiple buttons
Add more elements to
the arrays
Loop the elements
Run the application in MapInfo Pro x64
”Can I use my own images
on the buttons?”
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
Currently you can only refer to images in an asssembly if it’s located in the
MapInfo Pro installation folder. We are looking into improving this.
Internal MapInfo image
Image file on disk
Defines for Internal images
In the mbLibraries folder in a a file called MI_ICONS_X64.def you can find
defines for the internal images of MapInfo Pro 64 bit.
The file is included in the source code for the Ribbon Sample application in the
Library folder
Can I also make a Button checkable?
Or even modify the image on the
Button?
Create a Button and make it toggleable
Any Button can be checked so there isn’t a special CheckButton control
Use a modular variable to hold the index of the button
Let’s remember the index
of the control
Set the Control to be
”toggleable”
Create the handler and let it toggle the button
We are using two modular variables.One to hold
the current state of the button and another to hold
the index of the button
Change the state of the
button (checked/unchecked)
Here we change the Tooltip
and the image of the button
”Can I hide controls, groups
and tabs? Can I select a
certain tab?”
Hiding elements
You can change the visibility of the elements on the Ribbon.
Hide a tab
Hide a group on a tab
Show a control using the index
Hide a control using the names
Selecting tabs
You can select tabs to give these focus.
This could be useful if you load a tool and want to make sure
the user notices that you created some tools on a certain tab
What about splitbuttons?
Can I create these, too?
Add a SplitButton with a SplitButtonGroup
Start by adding a SplitButton control.
Then set the icon of the SplitButton to match the icon of the first button to
add to it later.
Also set the handler of the SplitButton to match the handler of the first
button, too.This will be the default action of the SplitButton
Finally, you can add a SplitButtonGroup
Adding the SplitButton
Adding a SplitButtonGroup
Set icons
Set handler
Adding buttons to the SplitButtonGroup
And then you can add the buttons to the SplitButtonGroup
This is similar to adding buttons to a Group on aTab
Adding the Buttons
Specify icons,
tooltips and
handlers
ControlID – needed in the handler
The handler/subprocedure
The the ID of the control
Did the user use the initial
button or did he select one
from the list?
Run the application in MapInfo Pro x64
Can you talk a bit about
Context menus?
Working with Context menus – Alter Menu
Context menus, aka. right click menus, are not
new to the Ribbon interface.
You can use the classicAlter Menu statement to
add menu items to an existing context menu.
Working with Context menus - RibbonLib
You can also use the RibbonLib to add ContextMenuItem controls to Context
menus – and add images to these as well.
But the Map MiniToolbar
can’t be modified, right?
Adding to the Map MiniToolbar
You can alos add controls, buttons or toolbuttons, to the
map mini toolbar to make certain tools easy accessible for
the user when working in a map window
Inserting a StackPanel
Adding a Tool_Button
Specifying a built-in command
”How can I easily integrate
my application in theTools
window?”
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
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
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
Include compiled modules in your project
You need to include several extra compiled modules in the MapBasic
project file
Reading/writing configuration files
Managing files and folders
Working with map windows
Aboutbox and programinformation
Handling strings i different languages
Working with strings
Run the application in MapInfo Pro x64
Do I really have to use the
RibbonLib for integrating
my application into the
Ribbon?
Other options
The RibbonLib helps you integrate your application into the
Ribbon interface using only MapBasic (and some .NET
methods).
You can achieve the same by using the methods declared in
IMapInfoPro.Def
Or by using the MapInfo Pro .NETAPI from a .NET language
such as C#
Our partner,AGIS, has developed a visual Ribbon Designer
SDK which lets you do this in a visual designer.
What did he just talk
about?
Summary
We have looked at
• Getting the RibbonLib
• Creating a MapBasic project
• CreatingTabs and Groups
• Creating Buttons
• Using your own images
• Creating checkable Buttons
• HidingTabs, Groups and Controls
• Creating SplitButtons
• Working with Context Menus
• Modifying the Map MiniToolbar
• The newTools window
• Other options for designing the interface
Questions?
Peter Horsbøll Møller | peter.moller@pb.com

Contenu connexe

En vedette

MAPINFO PROJECT
MAPINFO PROJECTMAPINFO PROJECT
MAPINFO PROJECT
Gargi Sen
 

En vedette (17)

Advanced SQL Selects
Advanced SQL SelectsAdvanced SQL Selects
Advanced SQL Selects
 
Relato de un naufrago
Relato de un naufragoRelato de un naufrago
Relato de un naufrago
 
MAPINFO PROJECT
MAPINFO PROJECTMAPINFO PROJECT
MAPINFO PROJECT
 
Whiskysmagning: Samaroli
Whiskysmagning: SamaroliWhiskysmagning: Samaroli
Whiskysmagning: Samaroli
 
Blend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt WhiskyBlend, Single Grain og Single Malt Whisky
Blend, Single Grain og Single Malt Whisky
 
Nyheder i MapInfo Pro 12.5 Dansk 32 bit
Nyheder i MapInfo Pro 12.5 Dansk 32 bitNyheder i MapInfo Pro 12.5 Dansk 32 bit
Nyheder i MapInfo Pro 12.5 Dansk 32 bit
 
Hvad sker der hos Pitney Bowes
Hvad sker der hos Pitney BowesHvad sker der hos Pitney Bowes
Hvad sker der hos Pitney Bowes
 
64 bits of MapInfo Pro - Danish version
64 bits of MapInfo Pro - Danish version64 bits of MapInfo Pro - Danish version
64 bits of MapInfo Pro - Danish version
 
Hvad påvirker en whisky
Hvad påvirker en whiskyHvad påvirker en whisky
Hvad påvirker en whisky
 
MapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedataMapInfo Pro Raster og de danske højdedata
MapInfo Pro Raster og de danske højdedata
 
MapInfo Discover 2015.2 64 bit
MapInfo Discover 2015.2 64 bitMapInfo Discover 2015.2 64 bit
MapInfo Discover 2015.2 64 bit
 
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bitMapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
MapInfo Pro 64 bit og MapInfo Pro Advanced 64 bit
 
MapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaverMapInfo Pro og SQL Server - Uden opgaver
MapInfo Pro og SQL Server - Uden opgaver
 
Using Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo ProUsing Spectrum on Demand from MapInfo Pro
Using Spectrum on Demand from MapInfo Pro
 
MapInfo Discover 3D: From 2D to 3D
MapInfo Discover 3D: From 2D to 3DMapInfo Discover 3D: From 2D to 3D
MapInfo Discover 3D: From 2D to 3D
 
Modul Map Info
Modul Map InfoModul Map Info
Modul Map Info
 
WMS, WFS og alle deres venner
WMS, WFS og alle deres vennerWMS, WFS og alle deres venner
WMS, WFS og alle deres venner
 

Similaire à Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016

6 Special Howtos for Drupal
6 Special Howtos for Drupal6 Special Howtos for Drupal
6 Special Howtos for Drupal
Wingston
 
wxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
wxFormBuilder - Tutorial on “A GUI for making GUIs” for PythonwxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
wxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
Umar Yusuf
 
Photoshop tutorial
Photoshop tutorialPhotoshop tutorial
Photoshop tutorial
Rohit Bapat
 

Similaire à Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016 (20)

Visual basic concepts
Visual basic conceptsVisual basic concepts
Visual basic concepts
 
Oracle User Productiviy Kit
Oracle User Productiviy KitOracle User Productiviy Kit
Oracle User Productiviy Kit
 
Intro to ArcGIS ModelBuilder
Intro to ArcGIS ModelBuilderIntro to ArcGIS ModelBuilder
Intro to ArcGIS ModelBuilder
 
Streamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptxStreamlining React Component Development and Sharing with bit.pptx
Streamlining React Component Development and Sharing with bit.pptx
 
exp-7-pig installation.pptx
exp-7-pig installation.pptxexp-7-pig installation.pptx
exp-7-pig installation.pptx
 
Practical%2006%20Big%20data%20analytics.pptx
Practical%2006%20Big%20data%20analytics.pptxPractical%2006%20Big%20data%20analytics.pptx
Practical%2006%20Big%20data%20analytics.pptx
 
Unit iv
Unit ivUnit iv
Unit iv
 
6 Special Howtos for Drupal
6 Special Howtos for Drupal6 Special Howtos for Drupal
6 Special Howtos for Drupal
 
Std 11 Computer Chapter 2 Animation Tool: Synfig
Std 11 Computer Chapter 2 Animation Tool: SynfigStd 11 Computer Chapter 2 Animation Tool: Synfig
Std 11 Computer Chapter 2 Animation Tool: Synfig
 
GUI in Matlab - 1
GUI in Matlab - 1GUI in Matlab - 1
GUI in Matlab - 1
 
Vb%20 tutorial
Vb%20 tutorialVb%20 tutorial
Vb%20 tutorial
 
Brandon Miller Portfolio
Brandon Miller PortfolioBrandon Miller Portfolio
Brandon Miller Portfolio
 
Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6Introduction to programming using Visual Basic 6
Introduction to programming using Visual Basic 6
 
Basic commands of ArcGIS
Basic commands of ArcGISBasic commands of ArcGIS
Basic commands of ArcGIS
 
Unit IV-Checkboxes and Radio Buttons in VB.Net in VB.NET
Unit IV-Checkboxes    and   Radio Buttons in VB.Net in VB.NET Unit IV-Checkboxes    and   Radio Buttons in VB.Net in VB.NET
Unit IV-Checkboxes and Radio Buttons in VB.Net in VB.NET
 
An Overview of RoboHelp 7
An Overview of RoboHelp 7An Overview of RoboHelp 7
An Overview of RoboHelp 7
 
wxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
wxFormBuilder - Tutorial on “A GUI for making GUIs” for PythonwxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
wxFormBuilder - Tutorial on “A GUI for making GUIs” for Python
 
Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)Hacking the Explored App by Adding Custom Code (UI5con 2016)
Hacking the Explored App by Adding Custom Code (UI5con 2016)
 
Photoshop tutorial
Photoshop tutorialPhotoshop tutorial
Photoshop tutorial
 
Adobe photoshop
Adobe photoshopAdobe photoshop
Adobe photoshop
 

Plus de Peter Horsbøll Møller

Plus de Peter Horsbøll Møller (8)

MapInfo Pro v12.5 to v2021.1 Overview
MapInfo Pro v12.5 to v2021.1 OverviewMapInfo Pro v12.5 to v2021.1 Overview
MapInfo Pro v12.5 to v2021.1 Overview
 
MapInfo Pro Tips & Tricks med Geograf
MapInfo Pro Tips & Tricks med GeografMapInfo Pro Tips & Tricks med Geograf
MapInfo Pro Tips & Tricks med Geograf
 
Eksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad WhiskylaugEksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
Eksklusivsmagning - 10 års jubilæum, Oksenvad Whiskylaug
 
Llinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProLlinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo Pro
 
Clynelish - Oksenvad Whiskylaug
Clynelish - Oksenvad WhiskylaugClynelish - Oksenvad Whiskylaug
Clynelish - Oksenvad Whiskylaug
 
The Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad WhiskylaugThe Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad Whiskylaug
 
Taking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo ProfessionalTaking Advantage of a Spatial Database with MapInfo Professional
Taking Advantage of a Spatial Database with MapInfo Professional
 
The strength of a spatial database
The strength of a spatial databaseThe strength of a spatial database
The strength of a spatial database
 

Dernier

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Dernier (20)

Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016

  • 1. Getting started with the Ribbon Library Peter Horsbøll Møller November 2016
  • 2. This will help you getting started with the Ribbon Library to develop MapBasic applications for the new ribbon based MapInfo Pro 64 bit.
  • 3. Prerequisites: Download and install: - MapInfo Pro 16.0 64 bit - MapBasic 16.0
  • 4. The Ribbon library is a custom made MapBasic module which is part of the broader mbLibrary. It makes it easier to integrate the most common controls into the Ribbon using MapBasic.
  • 5. Get the MapBasic Library - mbLibrary You can get the MapBasic Library from Github.com: Github.com: • https://github.com/PeterHorsbollMoller/mbLibrary
  • 6. Get the Ribbon Example Application You can get the Ribbon Example Application from: Github.com: • https://github.com/PeterHorsbollMoller/mbRibbonExample Community Download: • http://communitydownloads.pbinsight.com/code-exchange/download/ribbon- library-for-mapbasic
  • 7. Unzip the Ribbon Library Sample Application Sample tables Icons for the ribbon Full source code
  • 9. ”How can I use the Ribbon Library in my own MapBasic project?
  • 10. Create a new file structure Create a new base folder Create a sub folder for your MapBasic source code Base folder Source code
  • 11. Add the mbLibrary modules Copy the Library folder from the RibbonExample to your source code folder Or better: Copy the files and folders from the folder mbLibrary from the MapBasic Library to the Library folder here Base folder Source code Library
  • 12. 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: Create a main source code file (.mb) Include the RibbonLib header file Include some MapBasic header files Will show the new Notification
  • 13. Adding an EndHandler To make sure your application tidy up after itself, add an EndHandler to your application Compile with MapBasic 16.0 Call the EndHandler of the RibbonLib
  • 14. 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 16.0 Create a MapBasic Project file (.mbp) Name of final MapBasic application Compiled libraries to be included Your compiled module
  • 15. Run the application in MapInfo Pro x64
  • 16. ”How do I create a newTab and add a Group to it?”
  • 17. Add a newTab to the Ribbon 1. Check if theTab already exists 2. If not, add it Adding the new Tab Does it already exist? Internal name of the tab Caption of the tab, shown on the ribbon
  • 18. Run the application in MapInfo Pro x64
  • 19. 1. Check if the Group already exists 2. If not, add it Add a Group to theTab Adding the new Group Does it already exist? Internal name of the group Caption of the group, shown on the ribbon
  • 20. Run the application in MapInfo Pro x64
  • 21. How do I add a Button to my new Group?
  • 22. 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
  • 23. 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
  • 24. 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
  • 25. Run the application in MapInfo Pro x64
  • 26. Adding multiple buttons Add more elements to the arrays Loop the elements
  • 27. Run the application in MapInfo Pro x64
  • 28. ”Can I use my own images on the buttons?”
  • 29. 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 Currently you can only refer to images in an asssembly if it’s located in the MapInfo Pro installation folder. We are looking into improving this. Internal MapInfo image Image file on disk
  • 30. Defines for Internal images In the mbLibraries folder in a a file called MI_ICONS_X64.def you can find defines for the internal images of MapInfo Pro 64 bit. The file is included in the source code for the Ribbon Sample application in the Library folder
  • 31. Can I also make a Button checkable? Or even modify the image on the Button?
  • 32. Create a Button and make it toggleable Any Button can be checked so there isn’t a special CheckButton control Use a modular variable to hold the index of the button Let’s remember the index of the control Set the Control to be ”toggleable”
  • 33. Create the handler and let it toggle the button We are using two modular variables.One to hold the current state of the button and another to hold the index of the button Change the state of the button (checked/unchecked) Here we change the Tooltip and the image of the button
  • 34. ”Can I hide controls, groups and tabs? Can I select a certain tab?”
  • 35. Hiding elements You can change the visibility of the elements on the Ribbon. Hide a tab Hide a group on a tab Show a control using the index Hide a control using the names
  • 36. Selecting tabs You can select tabs to give these focus. This could be useful if you load a tool and want to make sure the user notices that you created some tools on a certain tab
  • 37. What about splitbuttons? Can I create these, too?
  • 38. Add a SplitButton with a SplitButtonGroup Start by adding a SplitButton control. Then set the icon of the SplitButton to match the icon of the first button to add to it later. Also set the handler of the SplitButton to match the handler of the first button, too.This will be the default action of the SplitButton Finally, you can add a SplitButtonGroup Adding the SplitButton Adding a SplitButtonGroup Set icons Set handler
  • 39. Adding buttons to the SplitButtonGroup And then you can add the buttons to the SplitButtonGroup This is similar to adding buttons to a Group on aTab Adding the Buttons Specify icons, tooltips and handlers ControlID – needed in the handler
  • 40. The handler/subprocedure The the ID of the control Did the user use the initial button or did he select one from the list?
  • 41. Run the application in MapInfo Pro x64
  • 42. Can you talk a bit about Context menus?
  • 43. Working with Context menus – Alter Menu Context menus, aka. right click menus, are not new to the Ribbon interface. You can use the classicAlter Menu statement to add menu items to an existing context menu.
  • 44. Working with Context menus - RibbonLib You can also use the RibbonLib to add ContextMenuItem controls to Context menus – and add images to these as well.
  • 45. But the Map MiniToolbar can’t be modified, right?
  • 46. Adding to the Map MiniToolbar You can alos add controls, buttons or toolbuttons, to the map mini toolbar to make certain tools easy accessible for the user when working in a map window
  • 47. Inserting a StackPanel Adding a Tool_Button Specifying a built-in command
  • 48. ”How can I easily integrate my application in theTools window?”
  • 49. 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
  • 50. 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
  • 51. 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
  • 52. Include compiled modules in your project You need to include several extra compiled modules in the MapBasic project file Reading/writing configuration files Managing files and folders Working with map windows Aboutbox and programinformation Handling strings i different languages Working with strings
  • 53. Run the application in MapInfo Pro x64
  • 54. Do I really have to use the RibbonLib for integrating my application into the Ribbon?
  • 55. Other options The RibbonLib helps you integrate your application into the Ribbon interface using only MapBasic (and some .NET methods). You can achieve the same by using the methods declared in IMapInfoPro.Def Or by using the MapInfo Pro .NETAPI from a .NET language such as C# Our partner,AGIS, has developed a visual Ribbon Designer SDK which lets you do this in a visual designer.
  • 56. What did he just talk about?
  • 57. Summary We have looked at • Getting the RibbonLib • Creating a MapBasic project • CreatingTabs and Groups • Creating Buttons • Using your own images • Creating checkable Buttons • HidingTabs, Groups and Controls • Creating SplitButtons • Working with Context Menus • Modifying the Map MiniToolbar • The newTools window • Other options for designing the interface
  • 58. Questions? Peter Horsbøll Møller | peter.moller@pb.com