Archicad 28 C++ API
Loading...
Searching...
No Matches
Modeless Palettes

Modeless Palettes

This paragraph describes the way an add-on can create modeless windows. The main usage of modeless windows is to create user-defined toolbars which can be used to interact between Archicad and the add-on.

The main points of developing an add-on that uses modeless windows are:

  • The window type must be Palette declared in the 'GDLG' resource. The resource ID of the palette should be between 32400 and 32499. This is a convention for avoiding collision with the dialog ID of the other modal and modeless windows. Resource IDs for modal dialogs can be between 32500 and 32767.
  • For initializing a modeless palette from your add-on's code, always use the DGModelessInit function of the DG module.
  • Note that the dialog ID may differ from the resource ID of a DG dialog. Generally the two values are equal, if there were no palettes with the same resource ID already initialized in the server application. Since the dialog IDs must be unique, the DG module will renumber your palette's dialog ID in the initialization phase if there the resource ID already was used for example from another add-on. This is why you should save dialog ID (which is the return value of DGModelessInit), and use as a reference to your palette instead of the constant resource ID.
  • Once initialized a palette the add-on is kept in memory and its palette callback function will be called to handle DG messages. After closing all the palettes belonging to the add-on, it ceases to be memory resident (unless it is kept in memory for some other reason).
  • In some cases (e.g. during user input) the server application blocks user action type messages towards the palette. It is the add-on's responsibility to disable its interface elements during this period to let the user know that the palette's functionality cannot be accessible. The server application notifies your code on the beginning and the termination of this situation by sending the DG_MSG_API_ENABLEPALETTE message.
    In case of getting user input initiated from your add-on, your dialog callbacks will not be blocked and will get the DG_MSG_API_ININPUTPALETTE message instead of DG_MSG_API_ENABLEPALETTE in order to let you keep enabled necessary dialog items (e.g. input modifiers).
  • Once your add-on has a modeless palette already initialized, it also can react to the Show/Hide All Palettes command called by the user from the Windows/Floating Palettes menu of Archicad. The palette callback gets a DG_MSG_API_SHOWHIDEPALETTE message every time when all the palettes should be hidden or shown. You are asked to handle this message by hiding or showing your palettes, and changing the appropriate menu texts, if your add-on has a "Show/Hide My Palette"-like menu command inserted into the menu structure.
  • The window cannot get any keyboard messages, only mouse events.
  • If you want some input in Archicad such as ACAPI_UserInput_GetPoint, remember to close all modal windows.