MapInfo Professional 12.5 x64 Developing with MapBasic Peter Horsbøll Møller GIS Pre-Sales Specialist 27. May 2014 Agenda New in MapBasic 12.5 Alpha New User Interface Integrating to the new ribbon interface External assemblies or dll 2 1 Alpha API Please note that this probably won’t be the final version of the API. We are already now considering some changes to it If you have thoughts or considerations on the API, please do let us know thru the MapInfo Forum: • http://forums.pb.com/t5/MapInfo-v12-5-64-Bit-Alpha 3 New in MapBasic 12.5 MapBasic updates in this alpha pre-release: Support for .NET Instance object and Interface Properties and Methods New variable types have been introduced - This, RefPtr, IntPtr, LargeInt, etc. There is a new definition file IMapInfoProfessional.def for method declarations The Set window [windowid] show | hide statement works on all windows You can close tool windows using MapBasic commands. For example, the statement Close window layercontrol will close the window. 4 2 New User Interface Button Control Ribbon Tab Mini Toolbar Control Group Workspace Explorer Gallery Control Statusbar 5 The structure The MapInfo application has a Ribbon The Ribbon holds a list of Ribbon Tabs A Ribbon Tab holds a list of Tab Group A Tab Group holds a list of Controls A Control can be of different types and have a number of settings, such as tooltip, image and handler In this workshop we will mostly look at the Button Control 6 3 Querying the Ribbon Get MapInfoApplication Get Ribbon Get Ribbon Tab Collection Get an existing Ribbon Tab Get an existing Ribbon Tab Group Collection Get an existing Ribbon Tab Group Get an existing Control Collection Get an existing Control 7 Exercise A01 Find the number of Ribbon Tabs 8 4 Exercise A02 Loop the Ribbon Tabs and show their name and caption 9 Exercise A03 Find the number of Tab Groups on each Tab 10 5 Exercise A04 Loop the Tab Groups on each Tab and show their name and caption 11 Exercise A05 Get the number of Controls on each Tab Group 12 6 Result 13 Integrating into the Ribbon Get MapInfoApplication Get Ribbon Get Ribbon Tab Collection Create a new Ribbon Tab Create a new Ribbon Tab Group Add a new Button and set the parameters of this button Store button, ribbon tab and tab group for later use 14 7 Exercise B01 Creating a new Ribbon Tab Creating a new Ribbon Control Group Adding a button to the Ribbon Control Group 15 Exercise B02 Adding yet a button to the Ribbon Control Group 16 8 Exercise B03 Adding two more buttons 17 Exercise B04 Removing the buttons from the Ribbon Control Group 18 9 Grouping Ribbon functionality You can group some of the functionality into procedures to minimise the amount of code Examples of this can be setting the tooltip and setting the images for buttons 19 Exercise C01 Moving the tooltip methods into a procedure 20 10 Exercise C02 Moving the image methods into a procedure 21 Exercise C03 Use small images in stead of big images 22 11 Integrating into existing Ribbon Tabs In stead of creating your own Tibbon Tab, you can add or insert your button on existing Control Groups on existing Ribbon Tabs To do so, you need to find the Ribbon Tab and then find the Control Group 23 Integrating into existing Ribbon Tabs Get MapInfoApplication Get Ribbon Get Ribbon Tab Collection Pick an existing Ribbon Tab Pick an existing Ribbon Tab Group Add a new Button and set the parameters of this button Store button, ribbon tab and tab group for later use 24 12 Exercise D01 Finding a Ribbon Tab GetRbnTabCollItemStr: Searches the Ribbon Tab Collection for a name. Can be hard to figure out if one was found Build your own logic that loops thru the Ribbon Tab Collection RefPrt variable 25 Exercise D02 Finding a Ribbon Control Group on a Ribbon Tab GetRbnCtrlGrpCollItemStr: Searches the Ribbon Control Group Collection for a name. Can be hard to figure out if one was found Build your own logic that loops thru the Ribbon Control Group Collection RefPrt variable 26 13 Exercise D03 Adding a Control to a Ribbon Control Group RbnCtrlGrpCollAddStrStr: Adds a new control to the end of the Ribbon Control Group 27 Exercise D04 Inserting a Control in a Ribbon Control Group at a certain position MICtrlCollInsertIntStrStrInt: Inserts a new control at a given position of the Ribbon Control Group. Note that the index starts at 0. 28 14 Questions? [email protected] Every connection is a new opportunity® 15
© Copyright 2026 Paperzz