TBC Macros and Extensions

 View Only
Expand all | Collapse all

Adding macros to existing ribbons

  • 1.  Adding macros to existing ribbons

    Posted 02-05-2025 06:40

    I am using the code included in the template to add my macros to the ribbon, but I'm finding if the tab already exists in the ribbon, another tab with the same name is added.
    I have customized the ribbon so that my field staff can do all of their tasks on a single ribbon, since they are not, and I do not expect them to be sophisticated TBC users.

    I have a tab named Field that is loaded from a bin file that also hides a lot of tabs they will never use. If I do this in my .py file, I get another tab called field. It looks like I have to add my macros to the customized ribbon manually, but I'd rather not do that because deploying new macros becomes a challenge. Am I missing something here?

        # if you want the macro included in the ribbon, fill in the following 5 lines
        cmdData.DefaultTabKey = "Field"
        cmdData.DefaultTabGroupKey = "Project"
        cmdData.ShortCaption = "Clean Feature Codes"
        cmdData.ToolTipTittle = "Clean Feature Codes"
        cmdData.ToolTipTextFormatted = "Change Feature Codes so they run cleanly in TBC."
        try:
            b = Bitmap(macroFileFolder + "\\" + cmdData.Key + ".png")
            cmdData.ImageSmall = b
        except:
            pass


    ------------------------------
    David Brubacher
    ------------------------------


  • 2.  RE: Adding macros to existing ribbons

    Posted 02-06-2025 12:46

    Hi David, 

    I couldn't reproduce the duplicate "Field" tabs (i only ever get one) based on the steps provided. 

    What I can say is there may somewhat be a misunderstanding of the ribbon and the import/export process.

    When you import the Ribbon, it will load exactly what was saved in the ribbon and not re-process after by adding additional commands.

    The imported ribbon is the "source of truth" and only the commands that were in the ribbon when export occurred will be added when re-imported. 

    Going this approach, I would anticipate that you would indeed need to add them manually to get the behavior you are looking for. 

    Hope this helps some (even though I don't believe it solves your issue). 



    ------------------------------
    Bryce Haire
    ------------------------------



  • 3.  RE: Adding macros to existing ribbons

    Posted 02-12-2025 14:39

    Yes, manual addition works fine. I've put some stub macros in place that I will fill in with actual operating code over the next few weeks to minimize reloading the menu customization.
    It works well for people exclusively in production but it's problematic for me with prod and dev versions of the same macros.



    ------------------------------
    David Brubacher
    ------------------------------