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

Add menu icon

Martin Walter
Enthusiast
I would like to add an icon to my menu entries:
How can I do this?
AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD
17 REPLIES 17
Solution
Martin Walter
Enthusiast
I finally solved the problem for me.
The indexes are the problem. It is not working this way:
'STR#' ID_MENU_STRINGS_NEW "Menu strings" {
/* [    ] */		"Planersoftware 2.0"
/* [  1] */		"Erstelle neues Fenster oder Tür^32101"
}
But this way:
'STR#' ID_MENU_STRINGS_NEW "Menu strings" {
/* [  1] */		"Planersoftware 2.0"
/* [  2] */		"Erstelle neues Fenster oder Tür^32101"
}
AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD
dushyant
Enthusiast
Hi Martin,
I just tried indexing your way (starting from 1 for the main menu), but I'm still not getting the menu-icon.

Dushyant Basson
Martin Walter
Enthusiast
Here is a working example for the first menu level.
AC22-27, Windows 11, i7-1355U, 32GB RAM, 2TB SSD
dushyant
Enthusiast
In your attached example,
DG_Test.grc has: "DG Functions^10000"
But DG_TestFix.grc has no identifier with 10000.
Ralph Wessel
Mentor
Martin wrote:
The indexes are the problem. It is not working this way:
'STR#' ID_MENU_STRINGS_NEW "Menu strings" {
/* [ ] */ "Planersoftware 2.0"
/* [ 1] */ "Erstelle neues Fenster oder Tür^32101"
}
Those aren't indices – they're just comments. The compiler ignores them, so they could contain nothing or not be there at all. We put them in as an easy visual check when referencing the menu items in code, i.e. ensuring the code aligns to the resources.
Ralph Wessel BArch
Software Engineer Speckle Systems
dushyant
Enthusiast
What guides the indenting of sub-menus? How to control which sub-menu can further have its own sub-menus?
Ralph Wessel
Mentor
If you're adding a custom menu, the number of items in the resource determines if it's a single menu item of a submenu. If there's only 2 items, the first is the main menu and the second is the menu item. If more than 2, the first is them main menu, the second is the submenu and any additional items are listed under the submenu. You can't nest menus any deeper than that.
For example:

'STR#' 32510  "Nested Menu" {
	"Main Menu"
	"Submenu"
	"Item 1"
	"Item 2"
	"Item 3"
}


'STR#' 32511  "Single Item" {
	"Main Menu"
	"Item 1"
}
The single menu item and submenu above will both appear under the menu "Main Menu".
Ralph Wessel BArch
Software Engineer Speckle Systems
Anonymous
Not applicable
We have our company standards available in our 'JHP' drop down menu and are able to get an icon at the parent level. One thing we have discovered is that the integer used as the reference for the menu item is of type short with a max value of 32767. Your original example, that did not work, uses 33000. The subsequent examples that do work use 32501, 32101, 10000, etc. - - all less than 32767.

Just a guess...