MapInfo Pro Developers User Group

 View Only

MapBasic, Python and .NET programmability improvements in upcoming Pro 2021 Release

  • 1.  MapBasic, Python and .NET programmability improvements in upcoming Pro 2021 Release

    Employee
    Posted 07-07-2021 14:33
    Edited by Bob Fortin 07-07-2021 14:41
    Below is a summary of the programmability improvements and changes in the upcoming Pro and MapBasic release.
    If you are interested in trying out the new version of Pro or the new MapBasic capabilities ahead of the release, we now have an alpha/beta version available on our "MapInfo Lab". Join the lab to get access to it.

    By far the biggest of these is the addition of full native MapBasic support for creating, modifying, and getting ribbon tabs, groups, and controls.
    Here is an example of creating a new ribbon tab with 3 buttons and a splitbutton


    Create Ribbon Tab "ControlsTab" Caption "MapTab"

             Active Index 2

             Properties(PROPERTY_ISTRACKED : "True", PROPERTY_TOOLTIP : "This is a Tab ToolTip", PROPERTY_KEYTIP : "Z")

             Group "MyToolsGroup" Caption "Tools"

             'Add a collection of three Tool button controls and a Split button with three Ribbon tool buttons for different selection tools

             Controls(     

                      Control "btnPan" Caption "Pan"

                               Type CTRL_TYPE_TOOLBUTTON

                               Size Small

                               Properties(PROPERTY_COMMANDID : M_TOOLS_RECENTER, PROPERTY_LARGEICON : MI_IMG_MAP_PAN_32, PROPERTY_SMALLICON : MI_IMG_MAP_PAN_16)

                      Control "btnZoom" Caption "Zoom"

                               Type CTRL_TYPE_TOOLBUTTON

                               Size Small

                               Properties(PROPERTY_COMMANDID : M_TOOLS_EXPAND, PROPERTY_LARGEICON : MI_IMG_MAP_ZOOMIN_32, PROPERTY_SMALLICON : MI_IMG_MAP_ZOOMIN_16)

                      Control "btnInfo" Caption "Info"

                               Type CTRL_TYPE_TOOLBUTTON

                               Size Small

                               Properties(PROPERTY_COMMANDID : M_TOOLS_PNT_QUERY, PROPERTY_LARGEICON : MI_IMG_MAP_INFOTOOL_32, PROPERTY_SMALLICON : MI_IMG_MAP_INFOTOOL_16)

                      Control "btnSplitSelect" Caption "Select"

                               Type CTRL_TYPE_SPLIT_BUTTON

                               Size Large Select 2  'set the Radius tool as selected

                               Properties(PROPERTY_LARGEICON : MI_IMG_MAP_SELECT_32, PROPERTY_SMALLICON : MI_IMG_MAP_SELECT_16)

                                        Controls(

                                                 Control "btnSelect" Caption "Select"

                                                          Type CTRL_TYPE_TOOLBUTTON

                                                          Size Large

                                                          Properties(PROPERTY_COMMANDID : M_TOOLS_SELECTOR, PROPERTY_LARGEICON : MI_IMG_MAP_SELECT_32, PROPERTY_SMALLICON : MI_IMG_MAP_SELECT_16)

                                                 Control "btnRadiusSelect" Caption "Radius"

                                                          Type CTRL_TYPE_TOOLBUTTON

                                                          Size Large

                                                          Properties(PROPERTY_COMMANDID : M_TOOLS_SEARCH_RADIUS, PROPERTY_LARGEICON : MI_IMG_MAP_AREASELECT_32, PROPERTY_SMALLICON : MI_IMG_MAP_AREASELECT_16)

                                                 Control "btnMarqueeSelect" Caption "Marquee"

                                                          Type CTRL_TYPE_TOOLBUTTON

                                                          Size Large

                                                          Properties(PROPERTY_COMMANDID : M_TOOLS_SEARCH_RECT, PROPERTY_LARGEICON : MI_IMG_MAP_MARQUEESELECT_32, PROPERTY_SMALLICON : MI_IMG_MAP_MARQUEESELECT_16)

                                        )

                      )



    Here is an example of using the RibbonInfo() function and the set ribbon statement:

    if RibbonInfo("btnRadio1", PROPERTY_ISCHECKED) then
    Set Ribbon Control "btnRadio1" Check
    Set Ribbon Control "btnRadio2" UnCheck
    Print "You Selected Right"
    else
    Set Ribbon Control "btnRadio1" UnCheck
    Set Ribbon Control "btnRadio2" Check
    Print "You Selected Left"
    end if

    MapBasic, Python and .NET  Pro 2021 Beta Summary

    Time Related Support

    • StringToDate() improved support for format and locale
    • StringToDateTime() improved support for format and locale
    • StringToTime() improved support for format and locale
    • FormatDate() improved support for format and locale
    • New FormatDateTime() function
    • FormatNumber$() now can specify desired precision
    • FormatTime$() allow for using the current time format
    • IsNull() function
    • DateAdd() function
    • DateTimeAdd() function
    • TimeAdd() function
    • DateSnap() function
    • TimeSnap() function
    • Set map time statement
    • Set map layer time statement
    • 20+ new LayerInfo() properties related to time and filtering
    • 25+ new MapperInfo() properties related to time and filtering
    • New TableInfo() property for filtering

    Support for registering new OGR table type tables

    New Sql Select Syntax to refresh or change a query table

    New Set map layer filter clause to support Layer Filters

    Task Related Support

    • MapBasic support for calling table background tasks
    • New TaskInfo() function
    • New Set task statement

    New SessionInfo() attributes to return all mapbasic tokens or just reserved tokens

    Added support for creating, modifying, and getting ribbon tabs, groups, and controls via MapBasic statements and functions

    • Create ribbon statement
    • Set ribbon statement
    • Over 15 different control types supported including galleries
    • Set ribbon control statement
    • RibbonInfo() and RibbonItemInfo() functions for returning values from a tab, group, or control
    • CommandInfo() support for getting name or fullname of ribbon control
    • New statement: Execute Ribbon Control "control_name" Handler 

    Regular Expression Support

    • New RegExReplace$() function
    • New RegExMatch$() function
    • New RegExSearch$() function

     Pro Python and .NET 2021 Beta Summary

    Object model properties and methods for time and filter support on maps and layers

    Updated Python modules to remove vulnerabilities



    ------------------------------
    Bob Fortin
    Software Architect and Distinguished Engineer
    MapInfo Pro Development Team
    ------------------------------