We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

Archicad C++ API
About Archicad add-on development using the C++ API.

Allow palette-using add-on to use FreeData

Anonymous
Not applicable
Hi!

I am currently implementing a palette inside my add-on, and have run into a new problem.
My Add-on now has a palette that can be opened / closed. So far, so good.

The problem is, during development, I cannot apply changes to the add-on and rebuild it, as it does not get unloaded when I close the palette.
In the "Control the Load unload mechanism" article, the following is said :
About FreeData : "Some operations (e.g. when an add-on has its own palette[...]) cause the add-on to stay in memory without calling this function."
And : "An add-on must be unloaded when [...], all the palettes have been dismissed, [...]."

So far, here are my "Init" functions (called separately through the code) and my "Closing" functions (called when the user closes the palette) :

Init functions :

// Initialising callback
DGModelessInit(ACAPI_GetOwnResModule(), 32400,
			ACAPI_GetOwnResModule(), PaletteCallback, (DGUserData)&pltctrl, true);	

// Inside the callback, on DG_MSG_INIT :
ACAPI_RegisterModelessWindow(dialID, PaletteAPIControlCallBack,
			API_PalEnabled_FloorPlan + [...] + API_PalEnabled_Layout)
Closing functions :

if (pltctrl.dialID != 0 && DGIsDialogOpen(pltctrl.dialID))
		DGModelessClose(pltctrl.dialID);	
if (pltctrl.dialID != 0)
{		
	DGEndProcessEvents(pltctrl.dialID);
	ACAPI_UnregisterModelessWindow(pltctrl.dialID);
	DGDestroyModelessDialog(pltctrl.dialID);
	DGDestroyPalette(pltctrl.dialID);
}
Using the debugger, I made sure every of these functions were launched.
Did I miss something to unload my Palettes?
Thanks !
0 REPLIES 0