<?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 Palette question in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264677#M2343</link>
    <description>&lt;DIV class="actalk-migrated-content"&gt;I managed to get my first add-on to work. Now I'd like to make it look good.&lt;BR /&gt;&lt;BR /&gt;- Is it possible to make an add-on palette dockable like the default archicad palettes to integrate it nicely in the UI.&lt;BR /&gt;&lt;BR /&gt;- The API documentation only mentions palettes, not toolbars. Is it possible to create toolbars, also dockable like the archicad ones ?&lt;/DIV&gt;</description>
    <pubDate>Wed, 15 Sep 2021 08:31:58 GMT</pubDate>
    <dc:creator>julienK</dc:creator>
    <dc:date>2021-09-15T08:31:58Z</dc:date>
    <item>
      <title>Palette question</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264677#M2343</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;I managed to get my first add-on to work. Now I'd like to make it look good.&lt;BR /&gt;&lt;BR /&gt;- Is it possible to make an add-on palette dockable like the default archicad palettes to integrate it nicely in the UI.&lt;BR /&gt;&lt;BR /&gt;- The API documentation only mentions palettes, not toolbars. Is it possible to create toolbars, also dockable like the archicad ones ?&lt;/DIV&gt;</description>
      <pubDate>Wed, 15 Sep 2021 08:31:58 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264677#M2343</guid>
      <dc:creator>julienK</dc:creator>
      <dc:date>2021-09-15T08:31:58Z</dc:date>
    </item>
    <item>
      <title>Re: Palette question</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264678#M2344</link>
      <description>&lt;BLOCKQUOTE&gt;juliencuadra wrote:&lt;BR /&gt;- Is it possible to make an add-on palette  dockable like the default archicad palettes to integrate it nicely in the UI.&lt;/BLOCKQUOTE&gt;
Yes, it's possible.&lt;BR /&gt;
You have to assign a guid to your palette. Use the constructor of DG::Palette parent class which has GS:Guid parameter:
&lt;PRE&gt;Palette (GSResModule resModule, short resId, GSResModule dialIconResModule, const GS::Guid&amp;amp; guid);&lt;/PRE&gt;
And do not forget to register your palette as a modeless window by using ACAPI_RegisterModelessWindow function.&lt;BR /&gt;
Example code (copied from Browser Control example Add-On, &lt;A href="http://archicadapi.graphisoft.com/browser-control-and-javascript-connection" target="_blank"&gt;&lt;LINK_TEXT text="http://archicadapi.graphisoft.com/brows ... connection"&gt;http://archicadapi.graphisoft.com/browser-control-and-javascript-connection&lt;/LINK_TEXT&gt;&lt;/A&gt;):
&lt;PRE&gt;static const GS::Guid	paletteGuid ("{ED852AD6-15E7-4812-AD88-FA1682E5D33C}");

...

MyPalette::MyPalette () :
	DG::Palette (ACAPI_GetOwnResModule (), MyPaletteResId, ACAPI_GetOwnResModule (), paletteGuid),
	...
{
	...
}


GSErrCode __ACENV_CALL	PaletteControlCallBack (Int32, API_PaletteMessageID messageID, GS::IntPtr param)
{
	switch (messageID) {
		case APIPalMsg_OpenPalette:
			if (!HasInstance ())
				CreateInstance ();
			GetInstance ().Show ();
			break;

		case APIPalMsg_ClosePalette:
			if (!HasInstance ())
				break;
			GetInstance ().Hide ();
			break;

		case APIPalMsg_HidePalette_Begin:
			if (HasInstance () &amp;amp;&amp;amp; GetInstance ().IsVisible ())
				GetInstance ().Hide ();
			break;

		case APIPalMsg_HidePalette_End:
			if (HasInstance () &amp;amp;&amp;amp; !GetInstance ().IsVisible ())
				GetInstance ().Show ();
			break;

		case APIPalMsg_DisableItems_Begin:
			if (HasInstance () &amp;amp;&amp;amp; GetInstance ().IsVisible ())
				GetInstance ().DisableItems ();
			break;

		case APIPalMsg_DisableItems_End:
			if (HasInstance () &amp;amp;&amp;amp; GetInstance ().IsVisible ())
				GetInstance ().EnableItems ();
			break;

		case APIPalMsg_IsPaletteVisible:
			*(reinterpret_cast&amp;lt;bool*&amp;gt; (param)) = HasInstance () &amp;amp;&amp;amp; GetInstance ().IsVisible ();
			break;

		default:
			break;
	}

	return NoError;
}



GSErrCode __ACENV_CALL	Initialize (void)
{
	GSErrCode err = ACAPI_RegisterModelessWindow (
					GS::GenerateHashValue (paletteGuid),
					PaletteControlCallBack,
					API_PalEnabled_FloorPlan + API_PalEnabled_Section + API_PalEnabled_Elevation +
					API_PalEnabled_InteriorElevation + API_PalEnabled_3D + API_PalEnabled_Detail +
					API_PalEnabled_Worksheet + API_PalEnabled_Layout + API_PalEnabled_DocumentFrom3D,
					GSGuid2APIGuid (paletteGuid));

	...

	return err;
}&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;juliencuadra wrote:&lt;BR /&gt;- The API documentation only mentions palettes, not toolbars. Is it possible to create toolbars, also dockable like the archicad ones ?&lt;/BLOCKQUOTE&gt;
Yes, it's possible.&lt;BR /&gt;
Toolbar is a special palette. Toolbar is a fixed sized palette. So if you want to implement a dockable toolbar, then you should inherit your class from DG::Palette, use the base class constructor which has GS::Guid parameter and finally in your GRC assign a noGrow flag to your dialog.&lt;BR /&gt;
Example GRC code:
&lt;PRE&gt;'GDLG'  32500    Palette | topCaption | close | noGrow   0   0  450  150  "My Toolbar"  {
...
}&lt;/PRE&gt;</description>
      <pubDate>Sun, 26 Jul 2020 19:17:22 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264678#M2344</guid>
      <dc:creator>Tibor Lorantfy</dc:creator>
      <dc:date>2020-07-26T19:17:22Z</dc:date>
    </item>
    <item>
      <title>Re: Palette question</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264679#M2345</link>
      <description>Thank you tibor.</description>
      <pubDate>Sun, 26 Jul 2020 20:44:39 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264679#M2345</guid>
      <dc:creator>julienK</dc:creator>
      <dc:date>2020-07-26T20:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Palette question</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264680#M2346</link>
      <description>Thanks to Tibor  I got my toolbar to work and dock nicely in the  archicad interface.&lt;BR /&gt;
&lt;BR /&gt;
I have a followup question: &lt;BR /&gt;
&lt;BR /&gt;
When I restart archicad, the toolbar is not displayed,  I have to go  in the menu to activate it. It then reappears at the location it was before.&lt;BR /&gt;
I tried saving my archicad environnement with the toolbar showing but that did not fix the problem.&lt;BR /&gt;
&lt;BR /&gt;
Is it possible to have an addon toolbar displayed at  startup ?</description>
      <pubDate>Mon, 03 Aug 2020 14:59:53 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-question/m-p/264680#M2346</guid>
      <dc:creator>julienK</dc:creator>
      <dc:date>2020-08-03T14:59:53Z</dc:date>
    </item>
  </channel>
</rss>

