SlideShare une entreprise Scribd logo
1  sur  40
Peter H. Møller

Senior Systems Engineer
Pitney Bowes Software
Using MapBasic to modify your user interface

Peter Horsbøll Møller
Pitney Bowes Software

2
What is MapBasic?
• MapBasic is a scripting language that makes it easy to
automate MapInfo Professional
• MapBasic is also a freely available compiler (and editor)
to compile MapBasic source code into MapBasic
applications (MBX)
• MapBasic is also the text that you see when you open a
workspace in a text editor

• MapBasic is all over within MapInfo Professional!

3
What is C#?
• C# is a Windows programming language developed by
Microsoft.
• C# does require a .NET Framework to be able to run
• Since MapInfo Professional v9.5 you can call/access
methods within C# (and other .NET language)
assemblies

4
What is the user interface?
• The user interface is what you use to make MapInfo
Professional do what you want it to do
• The user interface is
–
–
–
–

the toolbars and the buttons
the menus and the menu items
the Layer Control and the Table List windows
the different dialogs that pops up within MapInfo Professional

5
Using MapBasic to modify your user interface
Rearranging and creating shortcut keys

1

Modifying the MapInfo menu file

2

Adding shortcut keys using a MapBasic application

3

Building your own dialogs

4

Using .NET languages to build good looking user interfaces

6
What is the MapInfo menu file?
• The menu file - mapinfow.mnu is used by MapInfo Professional
to build the menus and toolbars
• It contains a number of
MapBasic statements for doing
this
• The menu file is plain ascii and
can be edited in a text editor,
like NotePad

7
Create Menu statements
Let’s look at the content
• Defining a new menu
• Defining a new menu item
• Ending a menu defintion (no
comma)
• Defining a sub menu in a menu
• Defining a separator

8
Create ButtonPad statements
Let’s look at the content
• Defining a new buttonpad/toolbar
• Defining a new button (push)
• Defining a new button (toggle)
• Defining a new button (tool)
• Setting initial state and width
• Defining a separator

9
Some notes
• Make a copy of your mapinfow.mnu before you start
modifying it!
• You mapinfow.mnu is normally found in the directory
where you installed MapInfo Professional. I can however
be read from other places. Use this statement in the
MapBasic window to locate the correct file, see path in
the message window afterwards:
– Print LocateFile$(7)

• Do remember the menu file i version specific, so you will
need to modify the file for each new version of MapInfo
Professional
10
Modifying the MapInfo menu file
Demo

12
Using MapBasic to modify your user interface
Static shortcut keys in an application

1

Modifying the MapInfo menu file

2

Adding shortcut keys using a MapBasic application

3

Building your own dialogs

4

Using .NET languages to build good looking user interfaces

13
What is a shortcut key?
• A shortcut key makes it
possible to access a feature
thru a key combination on
your keyboard
• Only menu items can have
shortcut keys – buttons can
not ...
• ... but you can create menu
items that ”call” the same
handler as the button

14
How do you define a shortcut key?
• Create Menu statement:
Create Menu newmenuname [ ID menu_id ] As
menuitem [ ID menu_item_id ] [ HelpMsg help ] {
Calling handler | As menuname } [ , menuitem
... ]

• You specify the shortcut key as part of the menu item
title:

15
Examples
• ”/W^N” is the shortcut for Ctrl + N
• ”tCtrl+N” adds the text ”Ctrl+N” at
the right side of the menu
• That is not necessay after v10 –
just create the shortcut and the
matching text will appear by default

16
Special keys
• It’s easy to assign ”normal” keys like a, b and z to menu items
using their character.
• But you can also use special key like F1, F2 and Home by
referring to their number
• Here is list of virtual key codes:
http://www.kbdedit.com/manual/low_level_vk_list.html
• For example Home has the numeric value 0x24 (hex). You
need to convert this to a decimal number. Use for instance:
http://www.statman.info/conversions/hexadecimal.html
• Now you can assign the value to a menu item like this:
“Zoom entire layer.../W#%36"
HelpMsg "Display an individual or all map layer(s)."
calling 807

17
Adding shortcut keys using a MapBasic application
Demo

• Defined in the Menu.def

19
Using MapBasic to modify your user interface
Custom made dialogs to make things easier

1

Modifying the MapInfo menu file

2

Adding shortcut keys using a MapBasic application

3

Building your own dialogs

4

Using .NET languages to build good looking user interfaces

20
Custom dialogs
• With MapBasic you can build applications containing
custom dialogs designed for your specific need
• These dialogs can be designed to access data, analyse
data, update attribute information and a number of other
use cases
• MapBasic dialogs are modal (like the old Layer Control
prior to MapInfo Pro 10.0). They can’t be floating (like the
new Layer Control added in MapInfo Pro 10.0)

21
Some examples

22
Control types
StaticText
PopupMenu

StaticText

StaticText
RadioGroup

ListBox
MultiListBox
GroupBox

PenPicker
BrushPicker
SymbolPicker
FontPicker

CheckBox

StaticText
EditText
OKButton

CancelButton
23
Let’s look at some MapBasic code

24
Handlers
• A handler is a subprocedure, called from the dialog
• A handler on the dialog itself is called when the dialog is
created and is being loaded
• You can use it to insert default values
• A handler on a control is called when the user ”uses” the
control
• It can be used to react to the actions/choices of the user,
like updating other control

25
Handler on the dialog

•

Creates a list of map windows

• Refreshes the control with the
•

list of windows
Activates the handler for this
control

26
Handler on a control

• Reads which windows is
selected in the control

• Creates a list of layers

• Refreshes the control with the
list of layers

27
Building your own dialogs
Using MapBasic to modify your user interface
Fancy looking windows, not dialogs

1

Modifying the MapInfo menu file

2

Adding shortcut keys using a MapBasic application

3

Building your own dialogs

4

Using .NET languages to build good looking user interfaces

29
Using .NET
• From MapInfo Professional 9.5 you have been able to
call .NET methods from your MapBasic applications
• This has given a wide range of new possibilities when
building applications to run inside MapInfo Professional

30
How is this done?
• Create a class with one or more static method
• Compile it into an assembly (.dll)
• Make the assembly
accessible for your
MapBasic app (copy it
to the same folder as
the app)
• Run your app

• Use the Declare Method statement to declare your
.NET method to MapBasic
• Call/use the method in your MapBasic app
• Compile (and link) your application
31
Create a new project in Visual Studio
• Choose the type ”Class Library”
• Name your project, here ”MapInfoDialog”
Add a static method
• Here we have added the method ShowDialog
Compile your .NET assembly
• Compiler your project thru Build > Build MapInfoDialog
– Or hit Shift + F6

• Note if there were any compile errors
Make the assembly accessible
• Copy the assembly to the folder where your compiled
MapBasic application will be located:
– MapInfoDialog.dll: The assembly
– MapInfoDialog.pdb: Debug information
Build your MapBasic application
• Declare Method
– Class: including Namesspaces
– Lib: without path but with ”.dll”

• Declare Sub Main
• Call ShowDialog(”some title”, ”some text to show in dialog”)
Compile and run your MapBasic application
• Compile
– Check for errors

• Run the application in MapInfo Pro
Some examples

38
Getting started with MapBasic?

Use the MapBasic
window

Look at your
workspaces

 Open the MapBasic window.
 Look at the statements MapInfo Pro write here when you do certain tasks

 Try to open a workspace in a text editor
 Look at the statements here

Find tools with
source code

 Have a look at the tools site, like MapInfoTools.com. Some tools do come with
source code.
 Have a look at these and try to modify them to fit your needs

Sign up for
MapInfo-L

 Signup for MapInfo-L on Google Groups: groups.google.com/group/mapinfo-l
 Follow and learn from the conversation here and start asking questions

39
Thank You
Peter Horsbøll Møller
peter.moller@pb.com

Contenu connexe

Tendances

Fungsi menu dan ikon ms.word
Fungsi menu dan ikon ms.wordFungsi menu dan ikon ms.word
Fungsi menu dan ikon ms.wordDoli Syahputra
 
Image Editing With Photoshop Cs
Image Editing With Photoshop CsImage Editing With Photoshop Cs
Image Editing With Photoshop Csbrighteyes
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments rameshkp054
 
Bài 6 Tìm hiểu LAYER - Giáo trình FPT
Bài 6 Tìm hiểu LAYER - Giáo trình FPTBài 6 Tìm hiểu LAYER - Giáo trình FPT
Bài 6 Tìm hiểu LAYER - Giáo trình FPTMasterCode.vn
 
Zebra sap-smartforms-solution
Zebra sap-smartforms-solutionZebra sap-smartforms-solution
Zebra sap-smartforms-solutionmartin_josep
 
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPT
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPTBÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPT
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPTMasterCode.vn
 
Introduction- The Basics of Photoshop CS6
Introduction- The Basics of Photoshop CS6Introduction- The Basics of Photoshop CS6
Introduction- The Basics of Photoshop CS6Crest TechnoSoft
 
Pttkpm 3 mo hinhusecase done
Pttkpm 3 mo hinhusecase donePttkpm 3 mo hinhusecase done
Pttkpm 3 mo hinhusecase doneNguyen Tran
 
Xây dựng biểu đồ use case
Xây dựng biểu đồ use caseXây dựng biểu đồ use case
Xây dựng biểu đồ use caseTrung Chinh Hà
 
Autocad lezione 6
Autocad lezione 6Autocad lezione 6
Autocad lezione 6Carella2014
 
Autocad lezione 3
Autocad lezione 3Autocad lezione 3
Autocad lezione 3Carella2014
 

Tendances (20)

Fungsi menu dan ikon ms.word
Fungsi menu dan ikon ms.wordFungsi menu dan ikon ms.word
Fungsi menu dan ikon ms.word
 
Microsoft word unidad 2
Microsoft word unidad 2Microsoft word unidad 2
Microsoft word unidad 2
 
Cơ bản về visual basic
Cơ bản về visual basicCơ bản về visual basic
Cơ bản về visual basic
 
Xuat bang ve
Xuat bang veXuat bang ve
Xuat bang ve
 
Image Editing With Photoshop Cs
Image Editing With Photoshop CsImage Editing With Photoshop Cs
Image Editing With Photoshop Cs
 
NoSql Database
NoSql DatabaseNoSql Database
NoSql Database
 
Dialog programming ABAP
Dialog programming ABAPDialog programming ABAP
Dialog programming ABAP
 
Cognos TM1 Assignments
Cognos TM1 Assignments Cognos TM1 Assignments
Cognos TM1 Assignments
 
Visual basic 6.0
Visual basic 6.0Visual basic 6.0
Visual basic 6.0
 
Bài 6 Tìm hiểu LAYER - Giáo trình FPT
Bài 6 Tìm hiểu LAYER - Giáo trình FPTBài 6 Tìm hiểu LAYER - Giáo trình FPT
Bài 6 Tìm hiểu LAYER - Giáo trình FPT
 
Zebra sap-smartforms-solution
Zebra sap-smartforms-solutionZebra sap-smartforms-solution
Zebra sap-smartforms-solution
 
crear tablas en word
crear tablas en wordcrear tablas en word
crear tablas en word
 
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPT
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPTBÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPT
BÀI 2 Tổng quan về ILLUSTRATOR CS4 - Giáo trình FPT
 
Introduction- The Basics of Photoshop CS6
Introduction- The Basics of Photoshop CS6Introduction- The Basics of Photoshop CS6
Introduction- The Basics of Photoshop CS6
 
Abap reports
Abap reportsAbap reports
Abap reports
 
Pttkpm 3 mo hinhusecase done
Pttkpm 3 mo hinhusecase donePttkpm 3 mo hinhusecase done
Pttkpm 3 mo hinhusecase done
 
Xây dựng biểu đồ use case
Xây dựng biểu đồ use caseXây dựng biểu đồ use case
Xây dựng biểu đồ use case
 
Autocad lezione 6
Autocad lezione 6Autocad lezione 6
Autocad lezione 6
 
Autocad lezione 3
Autocad lezione 3Autocad lezione 3
Autocad lezione 3
 
Libre Office Impress Lesson 1
Libre Office Impress Lesson 1Libre Office Impress Lesson 1
Libre Office Impress Lesson 1
 

Similaire à Using MapBasic to modify your user interface

Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Peter Horsbøll Møller
 
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 6Jeanie Arnoco
 
Automating Repetitive Tasks with MapBasic
Automating Repetitive Tasks with MapBasicAutomating Repetitive Tasks with MapBasic
Automating Repetitive Tasks with MapBasicPeter Horsbøll Møller
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03PCC
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Mark Vincent Cantero
 
VB6_OBJECTS AND GRAPHICS.ppt
VB6_OBJECTS AND GRAPHICS.pptVB6_OBJECTS AND GRAPHICS.ppt
VB6_OBJECTS AND GRAPHICS.pptBhuvanaR13
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfsheenmarie0212
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptBhuvanaR13
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshopdhi her
 
Vb6.0 Introduction
Vb6.0 IntroductionVb6.0 Introduction
Vb6.0 IntroductionTennyson
 

Similaire à Using MapBasic to modify your user interface (20)

Introduction to MapBasic
Introduction to MapBasicIntroduction to MapBasic
Introduction to MapBasic
 
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
Getting Started with the Ribbon library - MUGUKI User Group Meeting 2016
 
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
 
Automating Repetitive Tasks with MapBasic
Automating Repetitive Tasks with MapBasicAutomating Repetitive Tasks with MapBasic
Automating Repetitive Tasks with MapBasic
 
Csc153 chapter 03
Csc153 chapter 03Csc153 chapter 03
Csc153 chapter 03
 
Winisisx
WinisisxWinisisx
Winisisx
 
Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)Introduction to visual basic 6 (1)
Introduction to visual basic 6 (1)
 
Ms vb
Ms vbMs vb
Ms vb
 
Vb%20 tutorial
Vb%20 tutorialVb%20 tutorial
Vb%20 tutorial
 
Visual basic
Visual basicVisual basic
Visual basic
 
VB6_OBJECTS AND GRAPHICS.ppt
VB6_OBJECTS AND GRAPHICS.pptVB6_OBJECTS AND GRAPHICS.ppt
VB6_OBJECTS AND GRAPHICS.ppt
 
Visual basic
Visual basicVisual basic
Visual basic
 
Visual Basic.pptx
Visual Basic.pptxVisual Basic.pptx
Visual Basic.pptx
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Visual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdfVisual Basic IDE Intro.pdf
Visual Basic IDE Intro.pdf
 
VB6_INTRODUCTION.ppt
VB6_INTRODUCTION.pptVB6_INTRODUCTION.ppt
VB6_INTRODUCTION.ppt
 
VB PPT by ADI part-1.pdf
VB PPT by ADI part-1.pdfVB PPT by ADI part-1.pdf
VB PPT by ADI part-1.pdf
 
Practicalfileofvb workshop
Practicalfileofvb workshopPracticalfileofvb workshop
Practicalfileofvb workshop
 
Vb6.0 Introduction
Vb6.0 IntroductionVb6.0 Introduction
Vb6.0 Introduction
 
tL19 awt
tL19 awttL19 awt
tL19 awt
 

Plus de Peter Horsbøll Møller

Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Peter Horsbøll Møller
 
MapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryMapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryPeter Horsbøll Møller
 
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 WhiskylaugPeter Horsbøll Møller
 
Llinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProLlinking Spectrum dataflows to MapInfo Pro
Llinking Spectrum dataflows to MapInfo ProPeter Horsbøll Møller
 
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 ProPeter Horsbøll Møller
 
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 bitPeter Horsbøll Møller
 
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øjdedataPeter Horsbøll Møller
 
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 WhiskyPeter Horsbøll Møller
 
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 opgaverPeter Horsbøll Møller
 

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

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
 
Precisely MapInfo Pro v2019 and Roadmap
Precisely MapInfo Pro v2019 and RoadmapPrecisely MapInfo Pro v2019 and Roadmap
Precisely MapInfo Pro v2019 and Roadmap
 
Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019Be Location Intelligent with MapInfo Pro v2019
Be Location Intelligent with MapInfo Pro v2019
 
MapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You QueryMapInfo Pro v2019: Improving the Way You Query
MapInfo Pro v2019: Improving the Way You Query
 
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
 
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
 
Whiskysmagning: Samaroli
Whiskysmagning: SamaroliWhiskysmagning: Samaroli
Whiskysmagning: Samaroli
 
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
 
Hvad sker der hos Pitney Bowes
Hvad sker der hos Pitney BowesHvad sker der hos Pitney Bowes
Hvad sker der hos Pitney Bowes
 
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 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
 
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
 
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
 
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
 
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
 
The Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad WhiskylaugThe Macallan - Oksenvad Whiskylaug
The Macallan - Oksenvad Whiskylaug
 

Dernier

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observabilityitnewsafrica
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...itnewsafrica
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Nikki Chapple
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterMydbops
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 

Dernier (20)

Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security ObservabilityGlenn Lazarus- Why Your Observability Strategy Needs Security Observability
Glenn Lazarus- Why Your Observability Strategy Needs Security Observability
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...Zeshan Sattar- Assessing the skill requirements and industry expectations for...
Zeshan Sattar- Assessing the skill requirements and industry expectations for...
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
Microsoft 365 Copilot: How to boost your productivity with AI – Part one: Ado...
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Scale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL RouterScale your database traffic with Read & Write split using MySQL Router
Scale your database traffic with Read & Write split using MySQL Router
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 

Using MapBasic to modify your user interface

  • 1. Peter H. Møller Senior Systems Engineer Pitney Bowes Software
  • 2. Using MapBasic to modify your user interface Peter Horsbøll Møller Pitney Bowes Software 2
  • 3. What is MapBasic? • MapBasic is a scripting language that makes it easy to automate MapInfo Professional • MapBasic is also a freely available compiler (and editor) to compile MapBasic source code into MapBasic applications (MBX) • MapBasic is also the text that you see when you open a workspace in a text editor • MapBasic is all over within MapInfo Professional! 3
  • 4. What is C#? • C# is a Windows programming language developed by Microsoft. • C# does require a .NET Framework to be able to run • Since MapInfo Professional v9.5 you can call/access methods within C# (and other .NET language) assemblies 4
  • 5. What is the user interface? • The user interface is what you use to make MapInfo Professional do what you want it to do • The user interface is – – – – the toolbars and the buttons the menus and the menu items the Layer Control and the Table List windows the different dialogs that pops up within MapInfo Professional 5
  • 6. Using MapBasic to modify your user interface Rearranging and creating shortcut keys 1 Modifying the MapInfo menu file 2 Adding shortcut keys using a MapBasic application 3 Building your own dialogs 4 Using .NET languages to build good looking user interfaces 6
  • 7. What is the MapInfo menu file? • The menu file - mapinfow.mnu is used by MapInfo Professional to build the menus and toolbars • It contains a number of MapBasic statements for doing this • The menu file is plain ascii and can be edited in a text editor, like NotePad 7
  • 8. Create Menu statements Let’s look at the content • Defining a new menu • Defining a new menu item • Ending a menu defintion (no comma) • Defining a sub menu in a menu • Defining a separator 8
  • 9. Create ButtonPad statements Let’s look at the content • Defining a new buttonpad/toolbar • Defining a new button (push) • Defining a new button (toggle) • Defining a new button (tool) • Setting initial state and width • Defining a separator 9
  • 10. Some notes • Make a copy of your mapinfow.mnu before you start modifying it! • You mapinfow.mnu is normally found in the directory where you installed MapInfo Professional. I can however be read from other places. Use this statement in the MapBasic window to locate the correct file, see path in the message window afterwards: – Print LocateFile$(7) • Do remember the menu file i version specific, so you will need to modify the file for each new version of MapInfo Professional 10
  • 13. Using MapBasic to modify your user interface Static shortcut keys in an application 1 Modifying the MapInfo menu file 2 Adding shortcut keys using a MapBasic application 3 Building your own dialogs 4 Using .NET languages to build good looking user interfaces 13
  • 14. What is a shortcut key? • A shortcut key makes it possible to access a feature thru a key combination on your keyboard • Only menu items can have shortcut keys – buttons can not ... • ... but you can create menu items that ”call” the same handler as the button 14
  • 15. How do you define a shortcut key? • Create Menu statement: Create Menu newmenuname [ ID menu_id ] As menuitem [ ID menu_item_id ] [ HelpMsg help ] { Calling handler | As menuname } [ , menuitem ... ] • You specify the shortcut key as part of the menu item title: 15
  • 16. Examples • ”/W^N” is the shortcut for Ctrl + N • ”tCtrl+N” adds the text ”Ctrl+N” at the right side of the menu • That is not necessay after v10 – just create the shortcut and the matching text will appear by default 16
  • 17. Special keys • It’s easy to assign ”normal” keys like a, b and z to menu items using their character. • But you can also use special key like F1, F2 and Home by referring to their number • Here is list of virtual key codes: http://www.kbdedit.com/manual/low_level_vk_list.html • For example Home has the numeric value 0x24 (hex). You need to convert this to a decimal number. Use for instance: http://www.statman.info/conversions/hexadecimal.html • Now you can assign the value to a menu item like this: “Zoom entire layer.../W#%36" HelpMsg "Display an individual or all map layer(s)." calling 807 17
  • 18. Adding shortcut keys using a MapBasic application
  • 19. Demo • Defined in the Menu.def 19
  • 20. Using MapBasic to modify your user interface Custom made dialogs to make things easier 1 Modifying the MapInfo menu file 2 Adding shortcut keys using a MapBasic application 3 Building your own dialogs 4 Using .NET languages to build good looking user interfaces 20
  • 21. Custom dialogs • With MapBasic you can build applications containing custom dialogs designed for your specific need • These dialogs can be designed to access data, analyse data, update attribute information and a number of other use cases • MapBasic dialogs are modal (like the old Layer Control prior to MapInfo Pro 10.0). They can’t be floating (like the new Layer Control added in MapInfo Pro 10.0) 21
  • 24. Let’s look at some MapBasic code 24
  • 25. Handlers • A handler is a subprocedure, called from the dialog • A handler on the dialog itself is called when the dialog is created and is being loaded • You can use it to insert default values • A handler on a control is called when the user ”uses” the control • It can be used to react to the actions/choices of the user, like updating other control 25
  • 26. Handler on the dialog • Creates a list of map windows • Refreshes the control with the • list of windows Activates the handler for this control 26
  • 27. Handler on a control • Reads which windows is selected in the control • Creates a list of layers • Refreshes the control with the list of layers 27
  • 28. Building your own dialogs
  • 29. Using MapBasic to modify your user interface Fancy looking windows, not dialogs 1 Modifying the MapInfo menu file 2 Adding shortcut keys using a MapBasic application 3 Building your own dialogs 4 Using .NET languages to build good looking user interfaces 29
  • 30. Using .NET • From MapInfo Professional 9.5 you have been able to call .NET methods from your MapBasic applications • This has given a wide range of new possibilities when building applications to run inside MapInfo Professional 30
  • 31. How is this done? • Create a class with one or more static method • Compile it into an assembly (.dll) • Make the assembly accessible for your MapBasic app (copy it to the same folder as the app) • Run your app • Use the Declare Method statement to declare your .NET method to MapBasic • Call/use the method in your MapBasic app • Compile (and link) your application 31
  • 32. Create a new project in Visual Studio • Choose the type ”Class Library” • Name your project, here ”MapInfoDialog”
  • 33. Add a static method • Here we have added the method ShowDialog
  • 34. Compile your .NET assembly • Compiler your project thru Build > Build MapInfoDialog – Or hit Shift + F6 • Note if there were any compile errors
  • 35. Make the assembly accessible • Copy the assembly to the folder where your compiled MapBasic application will be located: – MapInfoDialog.dll: The assembly – MapInfoDialog.pdb: Debug information
  • 36. Build your MapBasic application • Declare Method – Class: including Namesspaces – Lib: without path but with ”.dll” • Declare Sub Main • Call ShowDialog(”some title”, ”some text to show in dialog”)
  • 37. Compile and run your MapBasic application • Compile – Check for errors • Run the application in MapInfo Pro
  • 39. Getting started with MapBasic? Use the MapBasic window Look at your workspaces  Open the MapBasic window.  Look at the statements MapInfo Pro write here when you do certain tasks  Try to open a workspace in a text editor  Look at the statements here Find tools with source code  Have a look at the tools site, like MapInfoTools.com. Some tools do come with source code.  Have a look at these and try to modify them to fit your needs Sign up for MapInfo-L  Signup for MapInfo-L on Google Groups: groups.google.com/group/mapinfo-l  Follow and learn from the conversation here and start asking questions 39
  • 40. Thank You Peter Horsbøll Møller peter.moller@pb.com