Grouping custom-made Add-in's in Pro

1462
8
Jump to solution
12-13-2021 03:49 AM
kirken
by
New Contributor III

Hello!

I have made several add-ins that I have placed in custom tab and groups:

kirken_0-1639393138558.png

In order to achieve this I have written cross-references in each config.daml file, so that each add-in could be used / installed alone, as well with others, but this makes code quite confusing and not easy to manage because every time a new add-in is created, I should update all other add-ins' config.daml files as well that belong to the same group. Is there any better solution for this? 
One, that I can think of, would be to use one add-in as compulsory to install and describe all other add-ins in that compulsory config.daml file (?), but it's not the best solution because I want that users can choose which add-ins they want to use.

(for cross-referencing different add-ins I'm using updatemodule element like this:

<updateModule refID="EditorIDModule">
<groups>
<updateGroup refID="MA_ETAK">
<insertButton refID="ETAKotsing_ShowButton"/>
</updateGroup>
</groups>
</updateModule>
<updateModule refID="AadressOtsing_Module">
<tabs>
<updateTab refID="MA_MainTab">
<insertGroup refID="MA_ETAK" />
</updateTab>
</tabs>
<groups>
<updateGroup refID="MA_ETAK">
<insertButton refID="ETAKotsing_ShowButton" />
</updateGroup>
</groups>
</updateModule>

 ).

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi, 

You need to combine both techniques: dependencies and insertTool/insertButton settings. Our projects contains more than 10 add-ins with about 50 tools/buttons and there is no problem with setting order in tabs, groups and etc.

At first you need to setup correctly add-in dependencies (using the same order as with your numbers).

Set that ETAKotsing depends XParing and etc.

"Insert" setting could have "before" value not only "after"

Your first XParing  module must have autoLoad="true", other modules autoLoad="false"

 

View solution in original post

8 Replies
GKmieliauskas
Esri Regular Contributor

Hi,

It is enough to make changes only in last add-in you created. Define dependencies in new add-in config.daml on other add-ins using dependencies section:

  <dependencies>
    <!-- id of "Add-in B" same as AddInInfo id="{00000000-0000-0000-0000-000000000000}"-->
    <dependency name="{00000000-0000-0000-0000-000000000000}" />
  </dependencies>

Then in updateModule section define where you want to see your new tools commands in existing tabs/groups of your other add-ins. As in your sample.

More info about dependencies here:

https://www.esri.com/content/dam/esrisites/en-us/about/events/media/UC-2019/technical-workshops/tw-6... 

 

kirken
by
New Contributor III

Thanks !!! 

0 Kudos
kirken
by
New Contributor III

Hi again!

I tested now the solution by GintautasKmieliauskas and unfortunately it's still not the best solution for me, because I found out that it's not the order of making add-ins and defining dependencies in their configuration files, but the order (alphabetical) of add-ins in folder from which they are loaded that matters. E.g. if add-in B has no reference to add-in A and add-in A has reference (dependency and updateModule defined) to add-in B, B still will not load in custom tab and group (although, yes, I can see it in Pro's add-in manager list). 
Then again if I rename them e.g B -> 1B and A ->2A, they both load correctly.

So, the only solution to this would be still to use many cross-references or rename all add-ins that follow previously made ones alphabetically descending?

Thanks! 

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi, 

You can specify order of  tools using insertTool/insertButton settings:

 

<insertTool refID="xxxxx_yyyyy" insert="after" placeWith="aaaaa_bbbbb" />

 

P.s. It works with insertGroup too.

 

kirken
by
New Contributor III

No, it's not the case, insert="after" shold be default value, I read from doc, and it's fine by me. I just don't get it. E.g. I've got two add-ins: 1. XParing (has no dependencies, created first) 2. ETAKotsing (has dependency on XParing and has to wait for Xparing to load first) like I have defined in ETAKotsing config:

 

<dependencies>    
    <!-- XParing-->
    <dependency name="{d65b3eea-564b-424e-9e00-6e4baf506b8d}" />
</dependencies>

 

in ETAKotsing config.daml I also update XParing module:

 

<updateModule refID="XParing_Module">
      <tabs>
        <updateTab refID="MA_MainTab">
          <insertGroup refID="MA_ETAK"/>
        </updateTab>
      </tabs>
      <groups>
        <updateGroup refID="MA_ETAK">
          <insertButton refID="ETAKotsing_ShowButton"/>
        </updateGroup>
      </groups>
    </updateModule>

 

but the result is that only ETAKotsing appears in MA_MainTab:

kirken_0-1639485183980.png

Then again, if I just change the alphabetical order in add-in loading folder:

kirken_1-1639485426432.png

I get the result that I want:

kirken_2-1639486014062.png

 

So, it seems that I'm missing something and defining ETAKotsing dependency on XParing is not working as Xpaing is not loaded first (unless they are in a correct alphabetical order in add-ins folder, which has to be their making order) . 

0 Kudos
GKmieliauskas
Esri Regular Contributor

Hi, 

You need to combine both techniques: dependencies and insertTool/insertButton settings. Our projects contains more than 10 add-ins with about 50 tools/buttons and there is no problem with setting order in tabs, groups and etc.

At first you need to setup correctly add-in dependencies (using the same order as with your numbers).

Set that ETAKotsing depends XParing and etc.

"Insert" setting could have "before" value not only "after"

Your first XParing  module must have autoLoad="true", other modules autoLoad="false"

 

kirken
by
New Contributor III

Ok thanks! I got something working and I got the idea how it should work (although not all combinations seem to work correctly but hopefully I'll figure out). 

0 Kudos
GKmieliauskas
Esri Regular Contributor

I make test with  ArcGIS Pro sample project :

https://github.com/Esri/arcgis-pro-sdk-community-samples/tree/master/Framework/CustomCategories 

Added two buttons  to ExtraReport1 daml:

        <button id="ExtraReport1_ButtonBefore" caption="ButtonBefore" className="ButtonBefore" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue32.png">
          <tooltip heading="Tooltip Heading">Tooltip text<disabledText /></tooltip>
        </button>
        <button id="ExtraReport1_ButtonAfter" caption="ButtonAfter" className="ButtonAfter" loadOnClick="true" smallImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue16.png" largeImage="pack://application:,,,/ArcGIS.Desktop.Resources;component/Images/GenericButtonBlue32.png">
          <tooltip heading="Tooltip Heading">Tooltip text<disabledText /></tooltip>
        </button>

Then update main module :

    <updateModule refID="CustomCategoriesExample_Module">
      <groups>
        <updateGroup refID="CustomCategoriesExample_Group1">
          <insertButton refID="ExtraReport1_ButtonBefore" insert="before" placeWith="CustomCategoriesExample_Ribbon_ShowReports"/>
          <insertButton refID="ExtraReport1_ButtonAfter" insert="after" placeWith="CustomCategoriesExample_Ribbon_ShowReports"/>
        </updateGroup>
      </groups>
    </updateModule>

All other stuff dependencies and autoload settings were in solution from beginning.

And result:

GintautasKmieliauskas_0-1639491674381.png

 

0 Kudos