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

How to add custom icon to the addon menu item?

Anonymous
Not applicable
Addon menu is registered in RegisterInterface function:

ACAPI_Register_Menu (32501, 0, MenuCode_UserDef, MenuFlag_Default);

How to add custom icon to the addon menu item?
6 REPLIES 6
Ralph Wessel
Mentor
Matti wrote:
Addon menu is registered in RegisterInterface function:
ACAPI_Register_Menu (32501, 0, MenuCode_UserDef, MenuFlag_Default);
How to add custom icon to the addon menu item?
You can see the answer in the documentation for Structure of an Add-on/Required Resources:
'STR#' 32500 "Menu strings" {
/* [  1] */     "Database Tracker"
/* [  2] */         "Enable red walls^32601"
/* [  3] */         "-"
/* [  4] */         "Enable column links"
/* [  5] */         "List links (selection)^S"
/* [  6] */         "List links (database)"
/* [  7] */         "-"
/* [  8] */         "List walls with assignments"
}
To quote:
API wrote:
You can see that the name of the first command ends with the string "^32601". This extension instructs ArchiCAD to assign a custom picture to the given menu item. The picture itself must be a bitmap resource ('GBMP') with the resource ID following the ^ character.
Ralph Wessel BArch
Anonymous
Not applicable
Thanks a lot, it worked!
Anonymous
Not applicable
I have couple of questions more:

I get the icon to the menu item, but how the make the background transparent? Image format is bmp. Setting white as transparent in the palette editor does't help.

The other issue is that grc compiler does't move bmp images defined in 'GBMP' to the object folder. I have to move the bmp's manually. With 'GICN' this working fine. Any ideas?
Karl Ottenstein
Moderator
I had the same question when I wrote my first add-on, as it seemed that the GRC stuff was not well-documented.

Take a look at the example called "Navigator_Test".

Look in RFIX>Images and note the green color background. It has RGB values of (0,128,128).

Then, look at the matching GRC file, an excerpt is here:
'GICN' 32411 "Section Link" {
          "SectionLink"
          0  128  128
}
This says that the icon resource number 32411 will be named "Section Link" and comes from a graphics file SectionLink.* with an RGB transparency color of (0,128,128).

The API documentation is not always complete, or organized in a way to make it easy to learn... but the many examples are the key to learning. Do not skip over them. Compared to visual resource environments such as available on most platforms, the cross-platform resource management tools for the devkit feel very much like you're back in the 1970's. A bit painful, but the result is at least cross-platform.

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
I have used GICN in button icons and the transparency works as you explained. But in the menu items I cannot use 'GICN'. I'm trying to get transparency to 'GBMP'.

Documentation says:

The picture itself must be a bitmap resource ('GBMP') with the resource ID following the ^ character.


Although the ArchiCAD DevKit documentations is good. For Java developer as me this is far from fun. Three platforms (win, intelmac, powerpc), three different IDE's (visualstudio, xcode, codewarrior), three different DevKits (10, 11, 12). That is a configuration hell.
Akos Somorjai
Graphisoft
Graphisoft
Matti wrote:
I have used GICN in button icons and the transparency works as you explained. But in the menu items I cannot use 'GICN'. I'm trying to get transparency to 'GBMP'.
The transparent section should have RGB = (192,192,192), and it should be a GBMP.

HTH,

Akos