<?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 re-opens automatically on changing views in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/326000#M1911</link>
    <description>&lt;P&gt;Some additional flagging is missing from the palette (DG_Test/OwnerDrawnListBoxPalette) code. The palette state should be stored before the palette temporarily goes to/comes back from hidden state due to window switching.&lt;/P&gt;&lt;P&gt;A static bool variable can be used to temporarily store the visibility state (paletteOpenAtClose):&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;</description>
    <pubDate>Mon, 03 Jan 2022 12:13:06 GMT</pubDate>
    <dc:creator>Miklos Vegh</dc:creator>
    <dc:date>2022-01-03T12:13:06Z</dc:date>
    <item>
      <title>Palette re-opens automatically on changing views</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/324271#M1910</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I used &lt;STRONG&gt;DG::Palette&lt;/STRONG&gt; for an addon and observed it auto re-opens after being closed, when I change to certain views. These are the steps to reproduce the scenario:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Open the palette (from the user addon menu)&lt;/LI&gt;&lt;LI&gt;Close the palette (using the close [x] button at the top-right corner)&lt;/LI&gt;&lt;LI&gt;Open the Profile Manager palette and click 'Edit'&lt;/LI&gt;&lt;LI&gt;Close the profile editing window.&lt;/LI&gt;&lt;LI&gt;The addon palette reappears.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;This can be tested with the example addon &lt;STRONG&gt;DG_Test&lt;/STRONG&gt; &amp;gt; &lt;STRONG&gt;OwnerDrawnListBoxPalette&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This however does &lt;EM&gt;not&lt;/EM&gt; happen with the '&lt;STRONG&gt;Favorites&lt;/STRONG&gt;' palette, for example. I want the addon palette to behave like that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Anyone any idea?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;P&gt;Dushyant&lt;/P&gt;</description>
      <pubDate>Mon, 06 Dec 2021 06:52:43 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/324271#M1910</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2021-12-06T06:52:43Z</dc:date>
    </item>
    <item>
      <title>Re: Palette re-opens automatically on changing views</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/326000#M1911</link>
      <description>&lt;P&gt;Some additional flagging is missing from the palette (DG_Test/OwnerDrawnListBoxPalette) code. The palette state should be stored before the palette temporarily goes to/comes back from hidden state due to window switching.&lt;/P&gt;&lt;P&gt;A static bool variable can be used to temporarily store the visibility state (paletteOpenAtClose):&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;</description>
      <pubDate>Mon, 03 Jan 2022 12:13:06 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/326000#M1911</guid>
      <dc:creator>Miklos Vegh</dc:creator>
      <dc:date>2022-01-03T12:13:06Z</dc:date>
    </item>
    <item>
      <title>Re: Palette re-opens automatically on changing views</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/326001#M1912</link>
      <description>&lt;P&gt;&lt;a href="https://community.graphisoft.com/t5/user/viewprofilepage/user-id/16450"&gt;@Miklos Vegh&lt;/a&gt;&amp;nbsp; That works perfectly! Thanks a tonne!!&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jan 2022 12:24:47 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Palette-re-opens-automatically-on-changing-views/m-p/326001#M1912</guid>
      <dc:creator>dushyant</dc:creator>
      <dc:date>2022-01-03T12:24:47Z</dc:date>
    </item>
  </channel>
</rss>

