<?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 How to unregister CatchNewElement observers? in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/384014#M894</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did anyone of you have success with unregistering a CatchNewElement observer?&lt;BR /&gt;I passed a `nullptr` for the handlerProc as described in the &lt;A href="https://archicadapi.graphisoft.com/documentation/acapi_notify_catchnewelement" target="_self"&gt;documentation&lt;/A&gt;.&lt;BR /&gt;Unfortunately the observer doesn't seem to unregister and my Add-On is still notified by new elements.&lt;BR /&gt;I've tried for all elemTypes (nullptr) and for specific ones.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Context&lt;/STRONG&gt;&lt;BR /&gt;I try to keep the Debug versions of my Add-Ons so that they are not persistently loaded.&lt;BR /&gt;Then I can recompile them without going into the Add-On manager or restarting Archicad.&lt;BR /&gt;But of course it's necessary to check behaviors of used observers.&lt;BR /&gt;For that it's convenient to be able to turn them off again and the Add-On is automatically unloaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
    <pubDate>Fri, 16 Jun 2023 14:13:02 GMT</pubDate>
    <dc:creator>BerndSchwarzenbacher</dc:creator>
    <dc:date>2023-06-16T14:13:02Z</dc:date>
    <item>
      <title>How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/384014#M894</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did anyone of you have success with unregistering a CatchNewElement observer?&lt;BR /&gt;I passed a `nullptr` for the handlerProc as described in the &lt;A href="https://archicadapi.graphisoft.com/documentation/acapi_notify_catchnewelement" target="_self"&gt;documentation&lt;/A&gt;.&lt;BR /&gt;Unfortunately the observer doesn't seem to unregister and my Add-On is still notified by new elements.&lt;BR /&gt;I've tried for all elemTypes (nullptr) and for specific ones.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&lt;STRONG&gt;Context&lt;/STRONG&gt;&lt;BR /&gt;I try to keep the Debug versions of my Add-Ons so that they are not persistently loaded.&lt;BR /&gt;Then I can recompile them without going into the Add-On manager or restarting Archicad.&lt;BR /&gt;But of course it's necessary to check behaviors of used observers.&lt;BR /&gt;For that it's convenient to be able to turn them off again and the Add-On is automatically unloaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;BR /&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jun 2023 14:13:02 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/384014#M894</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-06-16T14:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/393409#M895</link>
      <description>&lt;P&gt;Did you also put the element type you want to stop catching new element event?&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2023 03:46:54 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/393409#M895</guid>
      <dc:creator>ReignBough</dc:creator>
      <dc:date>2023-07-26T03:46:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/394219#M896</link>
      <description>&lt;P&gt;Yes I've also tried it with specifying the element type.&lt;/P&gt;</description>
      <pubDate>Thu, 03 Aug 2023 12:44:20 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/394219#M896</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-08-03T12:44:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/571522#M8753</link>
      <description>&lt;P&gt;Hi Bernd,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you tried to add: &lt;TT&gt;ACAPI_Element_InstallElementObserver (nullptr);&lt;/TT&gt; as well?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best, Akos&lt;/P&gt;</description>
      <pubDate>Thu, 19 Oct 2023 06:57:29 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/571522#M8753</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2023-10-19T06:57:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/572751#M8787</link>
      <description>&lt;P&gt;Hi Akos,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the idea! I finally got around to trying it. Unfortunately that didn't help either. Still the same behavior,&lt;BR /&gt;I think I've already tried that before and this time I also tried several different orders and combinations of unregistering the observer with&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;TT&gt;ACAPI_Notify_CatchNewElements (nullptr, nullptr)&lt;/TT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;TT&gt;ACAPI_Notify_CatchNewElements (&amp;amp;tbItem, nullptr)&lt;/TT&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;TT&gt;ACAPI_Notify_InstallElementObserver (nullptr)&lt;/TT&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;and the equivalent ACAPI_Element_.... functions for AC27.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is there a specific order of operations that you were thinking about?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Wed, 25 Oct 2023 20:23:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/572751#M8787</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2023-10-25T20:23:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/574532#M8834</link>
      <description>&lt;P&gt;Hi Bernd,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Have you also attached an observer? (AC27: `ACAPI_Element_AttachObserver()`)&lt;/P&gt;
&lt;P&gt;There is an `ACAPI_Element_DetachObserver()` which may help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The order I would call these:&lt;/P&gt;
&lt;P&gt;CatchNewElements&amp;nbsp;(&amp;amp;tbItem, ElementEventHandlerProc)&lt;/P&gt;
&lt;P&gt;InstallElementObserver (ElementEventHandlerProc)&lt;/P&gt;
&lt;P&gt;AttachObserver&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;DetachObserver&lt;/P&gt;
&lt;P&gt;InstallElementObserver (nullptr)&lt;/P&gt;
&lt;P&gt;CatchNewElements (&amp;amp;tbItem, nullptr)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best, Akos&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 08 Nov 2023 00:42:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/574532#M8834</guid>
      <dc:creator>Akos Somorjai</dc:creator>
      <dc:date>2023-11-08T00:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/587432#M9156</link>
      <description>&lt;P&gt;Hi Akos,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the further input! It took me a while to give it another try.&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;So now I've tried it exactly as suggested by you, but it doesn't work unfortunately. As soon as I add the outermost &lt;STRONG&gt;CatchNewElements&lt;/STRONG&gt; pair (register and unregister), the Add-On's &lt;STRONG&gt;FreeData&lt;/STRONG&gt; function isn't called anymore. So to me it really seems, that unregistering of &lt;STRONG&gt;CatchNewElements&lt;/STRONG&gt; doesn't signal Archicad that the Add-On can be fully unloaded.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Best,&lt;/P&gt;
&lt;P&gt;Bernd&lt;/P&gt;</description>
      <pubDate>Fri, 09 Feb 2024 07:00:27 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/587432#M9156</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2024-02-09T07:00:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/589795#M9211</link>
      <description>&lt;P&gt;maybe a stupid suggestion but have you iterated trugh all elements with the&amp;nbsp;&lt;SPAN&gt;ACAPI_Element_DetachObserver(guidOfElementLoL) call bevore calling:&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;err = ACAPI_Element_CatchNewElement(nullptr, nullptr); &lt;BR /&gt;err = ACAPI_Element_InstallElementObserver(nullptr);&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;my observer works just fine with attach and detach. but i didt try to unload the plugin since mine is allways loaded.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2024 09:41:55 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/589795#M9211</guid>
      <dc:creator>Joel Buehler</dc:creator>
      <dc:date>2024-02-26T09:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to unregister CatchNewElement observers?</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/590024#M9216</link>
      <description>&lt;P&gt;Hi Joel,&lt;BR /&gt;&lt;BR /&gt;Not a stupid question at all! And thanks for chiming in with your experience &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Yes I did try with detaching the observers of all elements first. Doesn't change anything and also it's the same behavior when working in an empty file.&lt;BR /&gt;&lt;BR /&gt;Which makes kind of sense, since the new element observer is not attached to single elements anyway (although it might be the same function as the normal element observer).&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 08:19:42 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/How-to-unregister-CatchNewElement-observers/m-p/590024#M9216</guid>
      <dc:creator>BerndSchwarzenbacher</dc:creator>
      <dc:date>2024-02-27T08:19:42Z</dc:date>
    </item>
  </channel>
</rss>

