Hi Everybody,
I've been tasked with updating our MapBasic app to work with MapInfo Pro 2023. A lot of it still works (except having to replace the rather out of date DDE comms with something a little more modern!!) but there are some things I'm struggling to convert.
One of those is our MapBasic app has (or should I say "had") a menu with a number of menu items as well as two tool buttons (which require the user to select a region before the rest of the functionality kicks in) and these were ending up in a "Legacy" Ribbon Tab.
I have managed to move our menu items into a new Ribbon as Push Buttons using code such as
'Get MIPro interface
mapinfoApplication = SystemInfo(SYS_INFO_IMAPINFOAPPLICATION)
'Get Ribbon
ribbon = GetRibbon(mapinfoApplication)
'Get RibbonTabs Collection
ribbonTabColl = GetTabsColl(Ribbon)
'Create the new Tab
ourAppRibbonTab = RbnTabCollAddStrStr(ribbonTabColl, "ourApp", "ourApp")
'Access the groups collection of the ribbon
ourAppTabGroupCollection = GetRbnTabGrps(ourAppRibbonTab)
'Create the "Actions" and "Tools" group
ourAppActionsGroup = RbnCtrlGrpCollAddStrStr(ourAppTabGroupCollection, "ourAppActions", TranslateText("Actions"))
ourAppToolsGroup = RbnCtrlGrpCollAddStrStr(ourAppTabGroupCollection, "ourAppTools", TranslateText("Tools"))
' Add the "Actions" buttons
Alter ButtonPad "ourAppActions"
Add PushButton
Calling ShowButtonHandler
Large Icon -1 File ApplicationDirectory$() & "Images\Show_selected_records_in_ourApp_32.png"
HelpMsg TranslateText("Show the selected item(s) in ourApp") & "\n" & TranslateText("Show...")
But if I try the same with a ToolButton, it still ends up on the Legacy Tab.
I found this comment in the MapInfo Pro 2023 MapBasic User Guide.pdf file which implies it cannot be done:
Custom drawing tools (created using the Create ButtonPad or Alter ButtonPad statements, with
the ToolButton subclause) are not supported by the current Layout window. Custom drawing tools
that work with Map windows are supported inside of map frames, but such tools only work on the
map frame after the frame is activated.
Is this actually the case - if so, how have tools like "Zoom In" and "Zoom Out" managed to get into ribbon groups as found on the "Map" Ribbon Tab as they are clearly Tool Buttons are they not?
Is there a way this can be done or is what was written in the pdf file correct? Otherwise what options do I have and could you provide maybe a simple example of how I do this in MapBasic 2023?
I found this post from a while back which seems to suggest it was possible in v17 but I guess it's not longer the case:
Adding Tool Button to Ribbon Interface (google.com)
Thanks in advance for your time,
Chris Nightingale
------------------------------
Chris Nightingale
Knowledge Community Shared Account
Burlington MA
------------------------------