Registers a modeless palette in the API.
GSErrCode ACAPI_RegisterModelessWindow ( Int32 referenceID, APIPaletteControlCallBackProc* callBackProc, GSFlags controlFlags, const API_Guid& paletteGuid = APINULLGuid );
Parameters
- referenceID
- [in] Arbitrary number to uniquely identify your modeless palette. (You can use the resource ID if you wish.)
- callBackProc
- [in] Callback procedure for handling special API messages. It is called by the API, independently of DG.
- controlFlags
- [in] Define the behavior of the palette above different Archicad windows (plan, 3D, section, layout), and in case of selection.
- paletteGuid
- [in] A unique identifier for recording the state of the palette in the Work Environment. Optional parameter, can be omitted.
Return Values
NoError
- The function has completed with success.
APIERR_BADID
- The passed
referenceID
has already been used. APIERR_MEMFULL
- No free memory was available for the new entry.
For other common API errors see the API Errors document.
Remarks
Modeless palettes now can be opened with the normal DG functions (either DGModelessInit
, or DG::Palette
). However, the API should know about the existence of an add-on’s palette, so that it could send special messages to the palette (see APIPaletteControlCallBackProc). This function registers the add-on’s modeless window with the API; call it from the Initialize
function.
API 11 introduced new values for the controlFlags
parameter: API_PalEnabled_Worksheet
, API_PalEnabled_Elevation
, and API_PalEnabled_InteriorElevation
.
Example
GSErrCode __ACENV_CALL Initialize (void) { GSErrCode err = ACAPI_Install_MenuHandler (DGTEST_MENU_STRINGSID, MenuCommandHandler); // If the palette is constructed and registered, the add-on will be not unloaded from the memory while Archicad runs. ACAPI_RegisterModelessWindow (OwnerDrawnListBoxPalette::ODLBPaletteRefId (), OwnerDrawnListBoxPalette::PaletteAPIControlCallBack, 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 + API_PalEnabled_ModelCompare, GSGuid2APIGuid (OwnerDrawnListBoxPalette::ODLBPaletteGuid ())); if (err != NoError) DBPrintf ("DG_Test:: Initialize() ACAPI_Install_MenuHandler failed\n"); return err; } // Initialize
Requirements
- Version: API 4.1 or later
- Header: ACAPinc.h