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

Add menu icon

Martin Walter
Enthusiast
I would like to add an icon to my menu entries:
How can I do this?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
1 ACCEPTED SOLUTION
17 REPLIES 17
Ralph Wessel
Mentor
Add the icon resource ID in the menu item resource like this:
"Help^32529"
Ralph Wessel BArch
Martin Walter
Enthusiast
I can't get it working.
No icon pictures show in my menu.

But the image is compiled correctly because in the RO directory appears a buttonVekaCreate&96.ico file.

This is my code:
------------------------------------
in RegisterInterface (void):

err = ACAPI_Register_Menu(ID_MENU_STRINGS1, ID_STATUS_STRINGS1, MenuCode_UserDef, MenuFlag_Default);
------------------------------------
in file .grc:

'STR#' ID_MENU_STRINGS1 "Menu strings" {
/* [  1] */		"WinDoPlan"
/* [  2] */		"Neues Fenster oder Tür^33000"
}
--------------------------------------
in file ...fix.grc:

'GICN' 33000 "buttonVekaCreate icon" {
    "buttonVekaCreate"
}
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Ralph Wessel
Mentor
How about the format and naming of your source images?
Ralph Wessel BArch
Martin Walter
Enthusiast
I'm working on windows and saved the images into the folder ..\RFIX\Images\
as .png
e.g. buttonVekaCreate.png

and my command for compiling the resources is taken from the examples:
..\APIDevelopmentKit23\Tools\Win\ResConv.exe" -m r -D WINDOWS -T W -q utf8 1252 -i "RINT\$(ProjectName).grc" -D _DEBUG -o "$(OutDir)\RO\$(ProjectName).grc.rc2
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Ralph Wessel
Mentor
Are you able to confirm that the resources and images are correctly embedded in the built add-on?
Ralph Wessel BArch
Martin Walter
Enthusiast
the file ArchicadPluginFix.grc.rc2 in the RO folder looks like this:


//nclude "DGDefs.h"

/*---- This file was created by GRC compiler --------------------------------------------*/
/*                                                                                       */
/*     Source file: RFIX\ArchicadPluginFix.grc              Code table: NUL              */
/*                                                                                       */
/*---- Version 2.0 - Windows ------------------------------ (c) 1996-2019 by GRAPHISOFT -*/


#include "MDIDs_APICD.h"

32500 MDID
BEGIN
	8, 0,
	0L + 707017037,
	0L + 4022811608
END

I33000&96	ICON "buttonVekaCreate&96.ico"

I33001&96	ICON "buttonVekaChange&96.ico"

I33002&96	ICON "buttonVekaSettings&96.ico"
-------------------------------------

so the icons are created
and I find the files in the RO folder:
buttonVekaChange&96.ico
buttonVekaCreate&96.ico
buttonVekaSettings&96.ico


what else can I check?
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
Martin Walter
Enthusiast
Obviously this is a BUG in Archicad API.
For the second level menu items the icons are working.
But not for the first level:

'STR#' DGTEST_MENU_STRINGSID "Menu strings" {
/* [   ] */		"Test"
/* [   ] */		"DG Functions^10000"
/* [  1] */			"Fill Settings^EL^10000"
/* [  2] */			"Library Browser^EL^10080"
AC23, Windows 10, i7-6700HQ, 8Gb RAM, 500Gb SSD
dushyant
Enthusiast
I am also facing the same issue - not able to get the icon at that level. And looking at ArchiCAD's default menus, icons are visible at that level. So it seems it should be possible..
Ralph Wessel
Mentor
I don't think the API allows you to set the icon for the parent item of a sub-menu
Ralph Wessel BArch

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!