<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Palette resource id should be unique, even in another addon it cannot be the same in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702761#M10889</link>
    <description>&lt;P&gt;This kind of callback (from GS examples):&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode __ACENV_CALL	OwnerDrawnListBoxPalette::PaletteAPIControlCallBack (Int32 referenceID, API_PaletteMessageID messageID, GS::IntPtr param)
{
	static bool paletteOpenAtClose = false;
	GSErrCode err = NoError;
	if (referenceID == OwnerDrawnListBoxPalette::ODLBPaletteRefId ()) {
		OwnerDrawnListBoxPalette&amp;amp; palette = OwnerDrawnListBoxPalette::GetInstance();
		switch (messageID) {
			case APIPalMsg_ClosePalette:
			case APIPalMsg_HidePalette_Begin:
				if (palette.IsVisible()) {
					paletteOpenAtClose = true;
					palette.Hide();
				} else {
					paletteOpenAtClose = false;
				}
				break;

			case APIPalMsg_OpenPalette:
				paletteOpenAtClose = true;
				// no break

			case APIPalMsg_HidePalette_End:
				if (paletteOpenAtClose &amp;amp;&amp;amp; !palette.IsVisible()) {
					palette.Show ();
				}
				break;

			case APIPalMsg_DisableItems_Begin:
				palette.DisableItems();
				break;

			case APIPalMsg_DisableItems_End:
				palette.EnableItems();
				break;

			case APIPalMsg_IsPaletteVisible:
				(*reinterpret_cast&amp;lt;bool*&amp;gt; (param)) = palette.IsVisible();
				break;

			default:
				break;
		}
	}

	return err;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This you can register in the regular initialize function using this API call:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;__APIEXPORT GSErrCode ACAPI_RegisterModelessWindow (Int32							referenceID,
																	  APIPaletteControlCallBackProc	*callBackProc,
																	  GSFlags						controlFlags,
																	  const API_Guid&amp;amp;				paletteGuid = APINULLGuid);
&lt;/LI-CODE&gt;&lt;P&gt;So this callback is not the regular onclick kind of callback. It can be used for a couple of things, eg. opening the palette by default when Archicad starts if the palette was opened when Archicad was closed before, otherwise just keeping it closed until the user wants to open it. It is not necessarily an essential thing to do, but it is nice to have.&lt;/P&gt;</description>
    <pubDate>Fri, 15 May 2026 09:16:00 GMT</pubDate>
    <dc:creator>eptar</dc:creator>
    <dc:date>2026-05-15T09:16:00Z</dc:date>
    <item>
      <title>Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702597#M10881</link>
      <description>&lt;P&gt;We have 2 addons using the same palette logic, so the good old copy and paste method helped us to create the palette in our new application. We used the same grc, changed the addonid, also created a new guid for the palette of our new addon so we can register a callback. During development there was no issue, since only one addon was loaded.&lt;/P&gt;&lt;P&gt;If just one of the addons is loaded, then addon A opens palette A, if only addon B is loaded, then it opens palette B.&amp;nbsp;&lt;/P&gt;&lt;P&gt;When both addons are loaded when I try to open the palette from addon B, the palette of addon A is opened. Addon A works the same way, it also opens palette A. If I change the resource id of the palette in one of the addons it starts to work as it is expected so addon A opens palette A, addon B opens palette B. As far as I know the resources are addon specific, we can use the same ids in different addons.&lt;/P&gt;&lt;P&gt;I am not sure if this is dev id specific, or global issue, so only a developer cannot use the same resource id for a palette in multiple addons, or none of the developers can use the same resource id for a palette to avoid such a racing condition. Currently we just tested it on windows, version 27 and 29, but this seems to be a general issue at least on windows.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier" color="grey"&gt;Operating system used: &lt;EM&gt;Windows 11 25H2&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 13 May 2026 21:08:13 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702597#M10881</guid>
      <dc:creator>eptar</dc:creator>
      <dc:date>2026-05-13T21:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702632#M10884</link>
      <description>&lt;P&gt;I don't know whats causing this problem, but it's not the fact that the palettes share the same resource ID. We have numerous add-ons with a palette sharing the same resource ID and haven't seen any problems (on Mac and Win)&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2026 09:56:36 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702632#M10884</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2026-05-14T09:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702675#M10885</link>
      <description>&lt;P&gt;But you also use the callbacks for reopening the palette after restarting Archicad and such? So not just the regular callback for button clicks, but the one like this:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;PaletteAPIControlCallBack(Int32 referenceID, API_PaletteMessageID messageID, GS::IntPtr param)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If we do not have these kind of functions in place, everything seems to work perfectly. Then if I have an open palette command it opens the right palette.&lt;/P&gt;&lt;P&gt;Actually it is not super important in our current project, but still it would be nice to know what the problem is.&lt;/P&gt;&lt;P&gt;In both addon in the callback mentioned above I write into the session report the ref id and the guid just in case:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;if (referenceID == Palette::RefId ()) {
ACAPI_WriteReport(...)
}&lt;/LI-CODE&gt;&lt;P&gt;In the session report I clearly see after clicking on the open palette command in one plugin, that both callbacks were executed, and both bypassed the condition.&amp;nbsp;The output is different, I see addon1, refId1, and guid1 in one case, and addon2, refId2 and guid2 in the other line.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I can state for sure:&lt;/P&gt;&lt;P&gt;- we use the same developer id in both addons&lt;/P&gt;&lt;P&gt;- we use different addonid (obviously)&lt;/P&gt;&lt;P&gt;- we use the same resource id in both addons for the palette dialog&lt;/P&gt;&lt;P&gt;- we use the same resource id for a very simple menu (basically open palette, and show manual kind of complexity)&lt;/P&gt;&lt;P&gt;- we use different guids for the dialogs&lt;/P&gt;&lt;P&gt;- we use different class names, which are in different namespaces regarding the palettes&lt;/P&gt;&lt;P&gt;- if I change the resource id only, everything seems to work perfectly.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My feeling is that somehow this is related to the resource id and the&amp;nbsp;PaletteAPIControlCallBack function.&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2026 15:27:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702675#M10885</guid>
      <dc:creator>eptar</dc:creator>
      <dc:date>2026-05-14T15:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702684#M10886</link>
      <description>&lt;P&gt;Very curious behavior.&lt;BR /&gt;I've tried the following:&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;Copy one of my Add-Ons "Room Coverings" with a palette and named it "test"&lt;/LI&gt;
&lt;LI&gt;Change the Add-On ID of the "test" project (and menu item strings so I can distinguish them).&lt;BR /&gt;But I left everything else (developer id, resource ids, even same palette GUIDs) the same&lt;/LI&gt;
&lt;LI&gt;Load both the "Room Coverings" and "test" Add-On&lt;/LI&gt;
&lt;LI&gt;Open/close palettes for each Add-On. Trying different orders of opening &amp;amp; closing.&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Everything works as it should. The menu item for the "Room Coverings" Add-On only opens its palette and the menu item&amp;nbsp; of the "test" Add-On opens only it's own palette too.&amp;nbsp;Tested on AC29 Windows.&lt;BR /&gt;So I wasn't able to reproduce your issue with my setup.&lt;BR /&gt;Can you show us the relevant parts on how you register the palette and how your PaletteAPIControlCallBack function looks like?&lt;BR /&gt;&lt;BR /&gt;Maybe even reduce your problem to a minimal case (palette code only) for us to try to reproduce it with your code.&lt;BR /&gt;&lt;BR /&gt;Best,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Thu, 14 May 2026 16:53:59 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702684#M10886</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2026-05-14T16:53:59Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702754#M10887</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/26198"&gt;@eptar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;But you also use the callbacks for reopening the palette after restarting Archicad and such? So not just the regular callback for button clicks, but the one like this:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;PaletteAPIControlCallBack(Int32 referenceID, API_PaletteMessageID messageID, GS::IntPtr param)&lt;/LI-CODE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;No, we don't use any callbacks like that. In what context is that being used?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 08:26:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702754#M10887</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2026-05-15T08:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702759#M10888</link>
      <description>&lt;P&gt;I'll going to do some scenarios over the weekend, maybe it is about mixing the c++ and c style concept a bit. I'll check what if I implement things clearly c++ style, compared to the current solution, cutting back the code basically to have only a button on the palette with a WriteReport, and deleting everything else physically from the code. I just do not like the way how events are implemented in the c++ approach in the GS samples. We used the&amp;nbsp;OwnerDrawnListBoxPalette to take some ideas from the examples in the devkit if I remember well, and adjusted that to our needs, ending up with something which is a little bit closer to the c# style of dialog handling. I'll check if I can implement our flow clearly with the c++ style and eliminate the DG functions completely. The&amp;nbsp;PaletteAPIControlCallBack is actually the same like in the&amp;nbsp;OwnerDrawnListBoxPalette sample, in some of the cases an extra invalidation logic is added because a disable all / enable all thing is not enough for us.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 08:58:28 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702759#M10888</guid>
      <dc:creator>eptar</dc:creator>
      <dc:date>2026-05-15T08:58:28Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702761#M10889</link>
      <description>&lt;P&gt;This kind of callback (from GS examples):&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;GSErrCode __ACENV_CALL	OwnerDrawnListBoxPalette::PaletteAPIControlCallBack (Int32 referenceID, API_PaletteMessageID messageID, GS::IntPtr param)
{
	static bool paletteOpenAtClose = false;
	GSErrCode err = NoError;
	if (referenceID == OwnerDrawnListBoxPalette::ODLBPaletteRefId ()) {
		OwnerDrawnListBoxPalette&amp;amp; palette = OwnerDrawnListBoxPalette::GetInstance();
		switch (messageID) {
			case APIPalMsg_ClosePalette:
			case APIPalMsg_HidePalette_Begin:
				if (palette.IsVisible()) {
					paletteOpenAtClose = true;
					palette.Hide();
				} else {
					paletteOpenAtClose = false;
				}
				break;

			case APIPalMsg_OpenPalette:
				paletteOpenAtClose = true;
				// no break

			case APIPalMsg_HidePalette_End:
				if (paletteOpenAtClose &amp;amp;&amp;amp; !palette.IsVisible()) {
					palette.Show ();
				}
				break;

			case APIPalMsg_DisableItems_Begin:
				palette.DisableItems();
				break;

			case APIPalMsg_DisableItems_End:
				palette.EnableItems();
				break;

			case APIPalMsg_IsPaletteVisible:
				(*reinterpret_cast&amp;lt;bool*&amp;gt; (param)) = palette.IsVisible();
				break;

			default:
				break;
		}
	}

	return err;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This you can register in the regular initialize function using this API call:&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;__APIEXPORT GSErrCode ACAPI_RegisterModelessWindow (Int32							referenceID,
																	  APIPaletteControlCallBackProc	*callBackProc,
																	  GSFlags						controlFlags,
																	  const API_Guid&amp;amp;				paletteGuid = APINULLGuid);
&lt;/LI-CODE&gt;&lt;P&gt;So this callback is not the regular onclick kind of callback. It can be used for a couple of things, eg. opening the palette by default when Archicad starts if the palette was opened when Archicad was closed before, otherwise just keeping it closed until the user wants to open it. It is not necessarily an essential thing to do, but it is nice to have.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 09:16:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702761#M10889</guid>
      <dc:creator>eptar</dc:creator>
      <dc:date>2026-05-15T09:16:00Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702767#M10890</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/26198"&gt;@eptar&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;This you can register in the regular initialize function using this API call:&lt;/P&gt;
&lt;LI-CODE lang="cpp"&gt;__APIEXPORT GSErrCode ACAPI_RegisterModelessWindow (Int32							referenceID,
																	  APIPaletteControlCallBackProc	*callBackProc,
																	  GSFlags						controlFlags,
																	  const API_Guid&amp;amp;				paletteGuid = APINULLGuid);
&lt;/LI-CODE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have you tried using a different ID to register the palette, i.e. some other unique identifier instead of the resource ID?&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 11:20:31 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702767#M10890</guid>
      <dc:creator>Ralph Wessel</dc:creator>
      <dc:date>2026-05-15T11:20:31Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702772#M10891</link>
      <description>&lt;P&gt;I used the same approach like mentioned above, so I have such a function:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;OwnerDrawnListBoxPalette::ODLBPaletteRefId ()&lt;/LI-CODE&gt;&lt;P&gt;I took the implementation from the sample, it calculates a hash based on the guid, and it is different in the different addons. I call that function to get the reference id.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;	ACAPI_RegisterModelessWindow(Palette::PaletteRefId(), Palette::PaletteAPIControlCallBack, API_PalEnabled_FloorPlan + API_PalEnabled_Section + API_PalEnabled_Elevation + API_PalEnabled_InteriorElevation + API_PalEnabled_Detail + API_PalEnabled_3D + API_PalEnabled_Worksheet, GSGuid2APIGuid(Palette::PaletteGuid()));&lt;/LI-CODE&gt;&lt;P&gt;But as I wrote I'll do some further experiment tomorrow or Sunday, I just wondered if anyone else experienced such a thing before. Especially, because if it is a global issue somehow, then it is one thing I can take care of my resource ids, but I do not have control over others.&lt;/P&gt;&lt;P&gt;Probably I will start from one of the GS examples to see if I can reproduce the issue with their approach with the pure c++ classes.&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 12:16:33 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702772#M10891</guid>
      <dc:creator>eptar</dc:creator>
      <dc:date>2026-05-15T12:16:33Z</dc:date>
    </item>
    <item>
      <title>Re: Palette resource id should be unique, even in another addon it cannot be the same</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702774#M10892</link>
      <description>&lt;P&gt;Thanks for sharing the relevant code bits. My code looks very similar and I think I also started out from the OwnerDrawnListBoxPalette example. But that was a few years ago&amp;nbsp;&lt;span class="lia-unicode-emoji" title=":grinning_face_with_sweat:"&gt;😅&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;Looking forward to see what your experiments bring up!&lt;/P&gt;</description>
      <pubDate>Fri, 15 May 2026 12:42:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-resource-id-should-be-unique-even-in-another-addon-it/m-p/702774#M10892</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2026-05-15T12:42:25Z</dc:date>
    </item>
  </channel>
</rss>

