Mapbasic : remove a control from the Home tab in the ribbon

220 views
Skip to first unread message

Nicholas G Lawrence

unread,
Aug 6, 2020, 9:29:37 PM8/6/20
to mapi...@googlegroups.com

Hello all,

 

I want to remove a button (control) from the Home tab in the ribbon of MapInfo v17 (64-bit)

 

I can get the ribbon tab collection by;

Call RegisterUriParser(New_GenericUriParser(1),"pack",-1)

mapinfoApplication = SystemInfo(SYS_INFO_IMAPINFOAPPLICATION)

Ribbon = GetRibbon(mapinfoApplication)

RibbonTabColl = GetTabsColl(Ribbon)

 

But, then how do I get the “Home” tab?

RbnTabCollGetEnumerator?

RbnTabCollIndexOf?

RbnTabCollContains?

 

I’ve successfully built a new tab with groups and buttons, but this is my first attempt at modifying an existing tab

 

Thanks,

Nick Lawrence
Senior Spatial Science Officer | Geospatial Technologies
Engineering & Technology | Transport and Main Roads

 

Floor 19 | 313 Adelaide Street | Brisbane City Qld 4000
GPO Box 1412 | Brisbane City Qld 4001
P: (07) 30667977
E: nicholas....@tmr.qld.gov.au
W:
www.tmr.qld.gov.au

 

***********************************************************************
WARNING: This email (including any attachments) may contain legally
privileged, confidential or private information and may be protected by
copyright. You may only use it if you are the person(s) it was
intended to be sent to and if you use it in an authorised way. No one
is allowed to use, review, alter, transmit, disclose, distribute, print
or copy this email without appropriate authority.

If this email was not intended for you and was sent to you by mistake,
please telephone or email me immediately, destroy any hardcopies of
this email and delete it and any copies of it from your computer
system. Any right which the sender may have under copyright law, and
any legal privilege and confidentiality attached to this email is not
waived or destroyed by that mistake.

It is your responsibility to ensure that this email does not contain
and is not affected by computer viruses, defects or interference by
third parties or replication problems (including incompatibility with
your computer system).

Opinions contained in this email do not necessarily reflect the
opinions of the Department of Transport and Main Roads,
or endorsed organisations utilising the same infrastructure.
***********************************************************************

Nicholas G Lawrence

unread,
Aug 6, 2020, 11:28:32 PM8/6/20
to mapi...@googlegroups.com

I was looking at these instructions

How to customize the MapInfo Pro Ribbon Interface

https://communitydownloads.pbinsight.com/assets/downloads/How_to_Customize_the_MapInfo_Pro_Ribbon_Interface.pdf?

 

And found this command, which I guess returns the Table tab?

RibbonTab = GetRbnTabCollItemInt (RibbonTabColl, 1)

Does this mean that the Table tab is identified by “1”?

Is this is true, is there a list of all the standard tabs?

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/88ae7840c7544cabb3b9abb4a11dad0a%40tmr.qld.gov.au.

Andrew

unread,
Aug 6, 2020, 11:51:00 PM8/6/20
to MapInfo-L
Hi Nick,

This will remove the Open Table button from the Home Tab.

Call RBNControlSetVisibility("TabHome", "HomeFile", "OpenTableButton", False)

If you wanted to remove the group File from the Home Tab use this

Call RBNGroupSetVisibility("TabHome", "HomeFile", False)


Regards
Andrew

Nicholas G Lawrence

unread,
Aug 25, 2020, 10:28:51 PM8/25/20
to mapi...@googlegroups.com

Hi Andrew,

 

How did you determine the name of the tab, group and control?

TabHome

HomeFile

OpenTableButton

 

Is there a master list somewhere of all the tabs, groups and controls in the ribbon?

 

The buttons I want to remove are the six basemap buttons under Base Maps in the drop-down from the Open control in the File group of the Home tab.

 

This is for MapInfo v17

 

Thanks,

Nick

--

--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.

Peter Horsbøll Møller

unread,
Aug 26, 2020, 2:17:59 AM8/26/20
to mapi...@googlegroups.com

Hi Nick

 

There’s few ways to get a complete list of the tabs, groups, and controls.

I have a def file that holds defines for the tabs and groups.

 

When you get into the nitty gritty part of all the controls, you’ll have to loop through them and capture their names.

You can do this with the RibbonExample application that I have posted on GitHub, and you can also do it with the ProSampleAddIn that comes with MapBasic.

 

I have attached the latest list of elements that I have created. Note that some of the controls can be from add-ins.

 

Peter Horsbøll Møller

www.precisely.com

 

Peter Horsbøll Møller
 
 

From: 'Nicholas G Lawrence' via MapInfo-L <mapi...@googlegroups.com>
Sent: 26. august 2020 04:29
To: mapi...@googlegroups.com
Subject: RE: [MI-L] Re: Mapbasic : remove a control from the Home tab in the ribbon

 

This message originated Externally. Use proper judgement and caution with attachments, links, or responses.

Ribbon Elements.txt

Nicholas G Lawrence

unread,
Aug 26, 2020, 9:41:23 PM8/26/20
to mapi...@googlegroups.com

I wrote this code which makes the “Base Maps” group in the Open button not visible. Which is what I want

The code relies upon the various controls being at known positions defined as Integer. It does work in v17 but might not work in other versions if the ribbon interface changes.

 

Include "icons.def"

Include "mapbasic.def"

Include "menu.def"

Include "IMapInfoPro.def"

Include "Enums.def"

 

Declare Sub Main

 

Sub Main

Dim mapinfoApplication As This

Dim Ribbon As This

Dim RibbonTabColl As This

Dim tabHome As This

Dim tabHomeGroups As This

Dim grpFile As This

Dim grpFileColl As This

Dim btnOpen As This

Dim btnOpenColl As This

Dim btnOpenBaseMaps As This

 

'get the ribbon

Call RegisterUriParser(New_GenericUriParser(1),"pack",-1)

mapinfoApplication=SystemInfo(SYS_INFO_IMAPINFOAPPLICATION)

Ribbon=GetRibbon(mapinfoApplication)

RibbonTabColl=GetTabsColl(Ribbon)

 

'get the first (0) tab

tabHome=GetRbnTabCollItemInt(RibbonTabColl,0)

 

'get the groups on the Home tab

tabHomeGroups=GetRbnTabGrps(tabHome)

 

'get the first (0) group

grpFile=GetRbnCtrlGrpCollItemInt(tabHomeGroups,0)

 

'get the collection of controls in the first group

grpFileColl=GetRbnCtrlGrpCtrls(grpFile)

 

'get the Open button

btnOpen=GetMICtrlCollItemInt(grpFileColl,0)

 

'get the collection of split controls

btnOpenColl=GetRbnSplitCtrlCtrls(btnOpen)

 

'get the second (1) group

btnOpenBaseMaps=GetMICtrlCollItemInt(btnOpenColl,1)

 

'Set the Base Maps group not visible

Call SetCtrlVisible(btnOpenBaseMaps,FALSE)

 

End Sub

Peter Horsbøll Møller

unread,
Aug 27, 2020, 1:36:03 AM8/27/20
to mapi...@googlegroups.com

Thanks for sharing, Nick.

 

You can use these methods and the name of the tabs/controls: GetRbnTabCollItemStr and GetMICtrlCollItemStr

'get the first (0) tab

tabHome = GetRbnTabCollItemStr(RibbonTabColl,"HomeFile")

 

and

'get the Open button

btnOpen = GetMICtrlCollItemStr(grpFileColl,"HomeFileOpenGallerySplitButton")

 

and

'get the second (1) group

btnOpenBaseMaps = GetMICtrlCollItemStr(btnOpenColl,"BaseMaps")

 

MapInfo Pro v2019 does have the Base Map group in the same location as v17 so your code should also work here.

I assume you have also removed the Base Map group from the Open splitbutton on the TABLE and MAP tab?

Nicholas G Lawrence

unread,
Aug 27, 2020, 2:29:10 AM8/27/20
to mapi...@googlegroups.com

I forgot about the TABLE and MAP tabs!

Thanks for the hint about using strings instead of integers

Peter Horsbøll Møller

unread,
Aug 27, 2020, 9:34:51 AM8/27/20
to mapi...@googlegroups.com

Hi Nick

 

I have too many small tools that I haven’t published yet on Github.

Cleaning up my tools I came across this one: mbBasemaps.

 

It basically does what your tool also does.

It removes one or more of the Bing and GeoMap controls from the Basemap group.

 

My version uses a configuration file to specify which controls to remove.

 

Sorry that I hadn’t shared this one before

 

Peter Horsbøll Møller

www.precisely.com

 

&mdash;
Peter Horsbøll Møller
p &nbsp+45 35 15 39 31
m
Reply all
Reply to author
Forward
0 new messages