BIM Coordinator Program (INT) April 22, 2024
Find the next step in your career as a Graphisoft Certified BIM Coordinator!
Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] Dockable palette - is it possible?

Anonymous
Not applicable
Is it possible to create a dockable custom palette like Info Box - in the other words, is it possible to create a window, which can be made floating or docked to some side of the working area?
Thanks.
24 REPLIES 24
Oleg
Expert
Hi Vladimir,

There is some "docking" support. May be it is not like you expect.
And I think a palette is dockable by default.

There are two functions related :

DGDisablePaletteDock
DGIsPaletteDocked

Same for C++ DG implementations (I use it)

DG::Palette::DisableDock
DG::Palette::IsDocked

It is all of I know. I have one dockable palette and it is docks.
So try and test.

Oleg
Anonymous
Not applicable
Hi, Oleg, and thanks for comprehensive reply!

I guess, the point is the ArchiCAD SDK I am using (version 10) have no function your mention.. Does this mean that support for dockable palettes had been introduced in later versions (11 or 12)? I would like to have the same addon UI and behavior for as much ArchiCAD versions as possible..
Oleg
Expert
AFAIR it is available from at last AC 9.
It seems, this functions are not documented so look in headers.
But this functions are not "enable" docking, so it is not so important actually.
I think, a docking works by default for any palette. (But I am not sure). Currently I have only one palette and it works.


Oleg.
Anonymous
Not applicable
It seems, this functions are not documented so look in headers.

Found them with your prompt in Support\Modules\DGLib\DG.h -thanks!
I think, a docking works by default for any palette. (But I am not sure).
But I cannot have the "dock" effect until applying DGCreateDockablePalette()..
Oleg
Expert
Hmm, DGCreateDockablePalette was the main reason.
I didnt know it, as I use DG::Palette.
I think all palletes is dockable by default, but it was not true.

Good luck

Oleg
Anonymous
Not applicable
Oleg, a few more questions, if you don't mind.

1. As far as I understand from your answers, AC SDK has a set of handy C++ classes, which are an alternative to the pure API calls.
Is there exists any documentation or examples of using of this classes - besides headers in the SDK's Support\Modules folder?

2. I have tried to use the DG::Palette like this:

// Declare global variable to hold a palette object reference
DG::Palette* g_pPalette = NULL; 
...
// Inintialize the reference in menu command handler
// and show the palette
if (!g_pPalette) 
  g_pPalette = new DG::Palette(32420);
g_pPalette->BeginEventProcessing();
g_pPalette->Show();
But it does not work: the panel became visible just for a bit of second and then disappears 😞
What's wrong with this code?
Oleg
Expert
Hi,

Unfortunately I have no time for more detailed answers.
This week will very hard.

1. Class Library is documented briefly in the DialogManager.chm
(may be it is in html docs too, I dont install it, so I dont know)
Examples...I dont remember well, but it seems there was example DGTest (not DG_Test)..may be it was in AC 9 API only.
But anyway I often use method - "try,test and guess"

2. I dont know what is wrong exactly. May be you need use this functions also.
ACAPI_RegisterModelessWindow
ACAPI_UnregisterModelessWindow

Also, I dont remember details, but I use constructor with Guid.

Oleg.
Karl Ottenstein
Moderator
Vladimir wrote:
1. As far as I understand from your answers, AC SDK has a set of handy C++ classes, which are an alternative to the pure API calls.
Is there exists any documentation or examples of using of this classes - besides headers in the SDK's Support\Modules folder?


These do not seem to be well-documented. The document called "DG Namespace" in the help file DG.html may be helpful.

The example project Automate_Functions has some of the DG:: namespace calls as an example.

I don't know much beyond that!

Cheers,
Karl
One of the forum moderators
AC 27 USA and earlier   •   macOS Ventura 13.6.6, MacBook Pro M2 Max 12CPU/30GPU cores, 32GB
Anonymous
Not applicable
Oleg, Karl, a hearty thank you for help!

All I need was the ACAPI_KeepInMemory(1) calls to prevent the addon from unloading from memory - as was explained by Ralph Wessel here.

Now I have a nice dockable palette which can live her own life -
and all this by due of a small piece of code - thanks for DG::Palette and DG::PanelObserver - miracle! 🙂

The only question: is it possible to make the palette name to appear in the Window > Palettes list, so the user can toggle the palette visibility by clicking the corresponding menu item?
Learn and get certified!