MapInfo Pro Developers User Group

 View Only
  • 1.  The MapBasic Common Libraries

    Posted 04-08-2025 19:53

    Hello, 

    Several years ago I developed a suite of MapBasic tools for our office and I have now set out to updating them. I am reading through many of the posts here but I want to clarify this first. Back then, it was hugely beneficial to go downloading a collection of modules I think were called the 'Common Libraries' developed by Peter Moller. In the builds come out since then (MB 2021 and 2023), have these libraries been integrated into the standard MapBasic functionality. 

    There was a time when I would include a standard set of modules like these below. 

    Include "...\MB_Common_Libs\RIBBONLib.def"
    Include "...\MB_Common_Libs\ProgramInfo.def"
    Include "...\MB_Common_Libs\MI_ICONS_X64.def"
    Include "...\MB_Common_Libs\ERRORLib.def"
    Include "...\MB_Common_Libs\FILELib.def"
    Include "...\MB_Common_Libs\LAYERLib.def"

    Now I believe at least some of these have been formally replaced or integrated into other libraries, and these may be obsolete. Is this the case?



    ------------------------------
    Brandon Shepherd
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------


  • 2.  RE: The MapBasic Common Libraries

    Employee
    Posted 04-09-2025 02:18

    Hi Brandon

    Glad you found the Common MapBasic Libraries useful.

    I still use these every time I build a new MapBasic tool. But of course, I may be a bit biased here :-)

    You can always get the latest version of the modules on GitHub: Common MapBasic Libraries

    The libraries are still evolving, and new capabilities and new modules are being added. You can always look at the Change Log to see what has changed over time.

    Improvements have been made to MapBasic, which in some respect can replace some of the functionality in these modules.

    One of the bigger changes is the new functions and statements to work with the ribbon directly through MapBasic instead of using the .NET methods. You can find more about this in the article here: MapBasic Monday: Using the Create Ribbon Tab Statement in MapBasic v2021. This can replace the use of the module RIBBONLib.

    The file MI_ICONS_X64.def can also be skipped as the icons are now defined in the file RibbonControls.def that comes with MapBasic. This file also holds the name of all the controls in the interface. This also means that the file RibbonElements.def isn't necessary anymore.

    Cheers

    Peter



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------



  • 3.  RE: The MapBasic Common Libraries

    Posted 04-09-2025 13:14

    Thanks Peter, 

    I am glad to see you are still updating the libraries. I've downloaded the mbLibrary and will make it my default environment.

    Is the best way to get reacquainted with their functionality to browse the .DEF files you think? It seems a lot of what I am used to has remained besides the ribbon interface. The ERRCreate() and Addin_Help/About functions became standard practice I remember. 



    ------------------------------
    Brandon Shepherd
    Knowledge Community Shared Account
    Shelton CT
    ------------------------------



  • 4.  RE: The MapBasic Common Libraries

    Employee
    Posted 04-10-2025 07:05
      |   view attached

    Hey

    I have attached a file with all the declares from the main modules. Maybe that comes in handy.

    And yeah, documentation is a shortcoming. I have tried to make the functions self-explanatory, but I know that may not always be true.

    Documentation could certainly be improved.

    Yeah, I have tried not making any breaking changes :-)

    All should work as you are used to.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------

    Attachment(s)

    zip
    alldeclares.zip   60 KB 1 version


  • 5.  RE: The MapBasic Common Libraries

    Posted 12-12-2025 01:13

    Is there a function to return the File Size of a specified file?
    And a function to return the Last Write Time of a specified file?
    Knowing these attributes of a file would allow me to replicate the functionality of robocopy, and trigger the over-writing of a file if and only if the destination was different to the source.



    ------------------------------
    Nick Lawrence
    Senior Spatial Science Officer
    Department of Transport and Main Roads (QLD)
    Brisbane QLD
    ------------------------------



  • 6.  RE: The MapBasic Common Libraries

    Employee
    Posted 12-16-2025 08:21

    Hey Nick

    I must admit that I have never used that.

    You should be able to get to the file size using a combination of WAPIFindFirstFile() / WAPIFindNextFile() WIN API functions and the details in the WIN32_FIND_DATA type.



    ------------------------------
    Peter Horsbøll Møller
    Principal Presales Consultant | Distinguished Engineer
    Precisely | Trust in Data
    ------------------------------