<?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: Innactive controls in docked pallete in Archicad C++ API</title>
    <link>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244542#M3983</link>
    <description>The problem is solved by using IconButton, which wasn't needed in MacOS.</description>
    <pubDate>Thu, 09 Nov 2017 14:08:19 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2017-11-09T14:08:19Z</dc:date>
    <item>
      <title>Innactive controls in docked pallete</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244540#M3981</link>
      <description>&lt;DIV class="actalk-migrated-content"&gt;Hello Archicad developers!&lt;BR /&gt;&lt;BR /&gt;I have an issue with a plugin which I'm developing for the windows version of Archicad 21. &lt;BR /&gt;&lt;BR /&gt;The actual issue is that I have a dockable palette, created with &lt;STRONG&gt;DGCreateDockablePalette&lt;/STRONG&gt;, which contains Icons and every Icon calls a function. If the palette is a free floating window when I click each Icon it calls the corresponding function, but I If dock my palette somewhere my Icons don't seem to work anymore. What could be the possible reason for this?&lt;BR /&gt;&lt;BR /&gt;Also I have my plugin already working for the MacOS version of Archicad 21 and there isn't any problem with my palette, no matter if its docked or not.&lt;BR /&gt;&lt;BR /&gt;Here is some of my code which calls the palette:&lt;BR /&gt;
&lt;PRE&gt;&lt;I&gt;
&lt;/I&gt;GSErrCode __ACENV_CALL MenuCommandHandler(const API_MenuParams *menuParams)
{


	if (menuParams-&amp;gt;menuItemRef.menuResID == 32500) {
		GSErrCode errorCode = ACAPI_CallUndoableCommand("Importer",
			[&amp;amp;]() -&amp;gt; GSErrCode {

			switch (menuParams-&amp;gt;menuItemRef.itemIndex) {
				//case  1: openWebView(); break;
			case 1: Do_PaletteInit(); break;
				//case  2: importFiles();break;
				//case  3: updateBuildups();break;

			default: return NoError;
			}
		});

		return errorCode;
	}
	return NoError;
}

// -----------------------------------------------------------------------------
// Dependency definitions
// -----------------------------------------------------------------------------
API_AddonType __ACENV_CALL	CheckEnvironment(API_EnvirParams* envir)
{
	//
	// Fill in the necessary information
	//
	RSGetIndString(&amp;amp;envir-&amp;gt;addOnInfo.name, 32000, 1, ACAPI_GetOwnResModule());
	RSGetIndString(&amp;amp;envir-&amp;gt;addOnInfo.description, 32000, 2, ACAPI_GetOwnResModule());

	//
	// Register command services
	//
	GSErrCode err = ACAPI_Register_SupportedService('ABCD', 4L);
	if (err != NoError)
		return APIAddon_DontRegister;

	return APIAddon_Normal;
}		/* RegisterAddOn */


		// -----------------------------------------------------------------------------
		// Interface definitions
		// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL	RegisterInterface(void)
{
	GSErrCode	err;

	//
	// Register menus
	//
	//err = ACAPI_Register_Menu (32500, 0, MenuCode_UserDef, MenuFlag_SeparatorBefore);
	err = ACAPI_Register_Menu(32500, 0, MenuCode_Palettes, MenuFlag_SeparatorBefore);

	return err;
}		/* RegisterInterface */


		// -----------------------------------------------------------------------------
		// Called when the Add-On has been loaded into memory
		// to perform an operation
		// -----------------------------------------------------------------------------
GSErrCode __ACENV_CALL	Initialize(void)
{

	GSErrCode err = NoError;
	static short result = 0;

	//
	// Install menu handler callbacks
	//
	err = ACAPI_Install_MenuHandler(32500, MenuCommandHandler);

	return err;

	//return err;
}		/* Initialize */


		// -----------------------------------------------------------------------------
		// Called when the Add-On is going to be unloaded
		// -----------------------------------------------------------------------------

GSErrCode __ACENV_CALL	FreeData(void)
{
	return NoError;
}		/* FreeData */


static short   myDialID = 0;

static GSErrCode __ACENV_CALL   PaletteAPIControlCallBack(Int32 referenceID, API_PaletteMessageID messageID, GS::IntPtr /*param*/)
{
	if (referenceID == myDialID) {
		switch (messageID) {
		case APIPalMsg_ClosePalette:      break;
		case APIPalMsg_HidePalette_Begin:   break;
		case APIPalMsg_HidePalette_End:      break;
		case APIPalMsg_DisableItems_Begin:
		case APIPalMsg_DisableItems_End:   // actually do nothing, because the input finish functionality the buttons have to stay enabled
		case APIPalMsg_IsPaletteVisible:
		case APIPalMsg_OpenPalette:         break;
		}
	}

	return NoError;
}

const short CloseButtonID = 1;
const short UpdateButtonID = 2;

static short DGCALLBACK CntlDlgCallBack(short message, short dialID, short item, DGUserData /*userData*/, DGMessageData msgData)
{
	OutputDebugString("CntlDlgCallBack");

	switch (message) {
		
	case DG_MSG_INIT:
		DGSetFocus(dialID, DG_NO_ITEM);

		if (ACAPI_RegisterModelessWindow(dialID, PaletteAPIControlCallBack,
			API_PalEnabled_FloorPlan + API_PalEnabled_Section + API_PalEnabled_Elevation +
			API_PalEnabled_InteriorElevation + API_PalEnabled_Detail + API_PalEnabled_Worksheet + API_PalEnabled_3D + API_PalEnabled_Layout) != NoError)
			DBPrintf("ACAPI_RegisterModelessWindow failed\n");
		break;

	case DG_MSG_ACTIVATE:      break;
	case DG_MSG_UPDATE:         break;
	case DG_MSG_CHANGE:         break;
	case DG_MSG_DOUBLECLICK:   break;

	case DG_MSG_CLICK:
		switch (item) {
			
		case 1:   openWebView("sg"); break;
		case 2:   openWebView("search"); break;
		case 3:   openWebView("favourites"); break;
		case 4:   openWebView("messages"); break;
		case 5:   openWebView("settings"); break;
		case 6:   ACAPI_CallUndoableCommand("importFiles", [&amp;amp;]() -&amp;gt; GSErrCode { importFiles(); return (0); });


		case DG_CLOSEBOX:
			return item;   // this will result in a DG_MSG_CLOSE message
		}
		break;

	case DG_MSG_GROW:
	{
		short   vgrow = DGGetVGrow(msgData);
		short   hgrow = DGGetHGrow(msgData);
		DGBeginMoveGrowItems(dialID);
		//DGMoveItem (dialID, NavCloseButton, hgrow, vgrow);
		//DGMoveItem (dialID, NavUpdateButton, hgrow, vgrow);
		DGEndMoveGrowItems(dialID);
	}
	break;

	case DG_MSG_CLOSE:
		ACAPI_UnregisterModelessWindow(myDialID);
		myDialID = 0;
		break;

	default:
		break;
	}

	return (0);
}      // CntlDlgCallBack

static GS::Guid dialogGUID("{9597C98D-95BD-48d9-9999-C2297834806B}");

static bool      Do_PaletteInit(void)
{	

	if (myDialID == 0 || !DGIsDialogOpen(myDialID)) {
		//myDialID = DGModelessInit (ACAPI_GetOwnResModule (), 32400, ACAPI_GetOwnResModule (), CntlDlgCallBack, NULL, 1);
		myDialID = DGCreateDockablePalette(ACAPI_GetOwnResModule(), 32400, ACAPI_GetOwnResModule(), CntlDlgCallBack, NULL, dialogGUID);
	}
	

	DGBeginProcessEvents(myDialID);
	DGShowModelessDialog(myDialID, 0);


	return myDialID != 0;
}      // Do_PaletteInit



&lt;/PRE&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 12 Jul 2023 18:37:10 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244540#M3981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2023-07-12T18:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Innactive controls in docked pallete</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244541#M3982</link>
      <description>I have found the problem - when I replace the Icon with Button it seems to work. So now the question now is can I have buttons with images inside of them ?</description>
      <pubDate>Thu, 09 Nov 2017 13:37:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244541#M3982</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-09T13:37:00Z</dc:date>
    </item>
    <item>
      <title>Re: Innactive controls in docked pallete</title>
      <link>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244542#M3983</link>
      <description>The problem is solved by using IconButton, which wasn't needed in MacOS.</description>
      <pubDate>Thu, 09 Nov 2017 14:08:19 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/Archicad-C-API/Innactive-controls-in-docked-pallete/m-p/244542#M3983</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-11-09T14:08:19Z</dc:date>
    </item>
  </channel>
</rss>

