cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 
2024 Technology Preview Program

2024 Technology Preview Program:
Master powerful new features and shape the latest BIM-enabled innovations

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

Menu problem

ReignBough
Enthusiast
I've got the following basic code for loading the menu strings of my add-on:
GSErrCode err = NoError;
err = ACAPI_Register_Menu(ID_MENU_STR_1, ID_MENU_STA_1, MenuCode_UserDef, MenuFlag_SeparatorBefore);
PrintfError(__LINE__, err);
//else //if (err == NoError)
err = ACAPI_Register_Menu(ID_MENU_STR_2, ID_MENU_STA_2, MenuCode_UserDef, MenuFlag_InsertIntoSame);
PrintfError(__LINE__, err);
where: PrintError() prints error detail to debug view even on release mode).

I release build it. It runs okay on another PCs except 1. Although it loads the first string, the second string does not load on that PC. But when I reload the add-on, it runs okay. Also, the PrintError() prints a NoError.

What causes this problem and how to fix it?
~ReignBough~
ARCHICAD 26 INT (from AC18)
Windows 11 Pro, AMD Ryzen 7, 3.20GHz, 32.0GB RAM, 64-bit OS
5 REPLIES 5
gehairing
Participant
Hi,

Sorry i can't help you.

I wanted just to say that i have many problems with menu item creation.
When i add menu items once, build & run my addon...then i change the menu items (names, positions via the MenuCode_xxx) the menu won't change. I try rebuilding everything, compile the grc individually. Nothing changes.

I turn cray with this. Loosing a lot of time.

So there is a problem for sure...but what.
Erenford
Booster
gehairing wrote:
When i add menu items once, build & run my addon...then i change the menu items (names, positions via the MenuCode_xxx) the menu won't change. I try rebuilding everything, compile the grc individually. Nothing changes.
Changes in the menu / .grc files will not show up immediately with a simple build. You need to rebuild the addon (using Build sometimes doesn't recompile the .grc files), THEN close your ArchiCAD and open it again (close everything to make sure). Either that or remove and reattach the addon.

The menu stuff is only updated during addon's CheckEnvironment / RegisterInterface, which loads during ArchiCAD's startup or when addon is attached.
Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
gehairing
Participant
Erenford wrote:

Changes in the menu / .grc files will not show up immediately with a simple build. You need to rebuild the addon (using Build sometimes doesn't recompile the .grc files), THEN close your ArchiCAD and open it again (close everything to make sure). Either that or remove and reattach the addon.

The menu stuff is only updated during addon's CheckEnvironment / RegisterInterface, which loads during ArchiCAD's startup or when addon is attached.
Thanks a lot for your answer.

Yes of course i rebuild completely the plugin because the simple build only rebuilds the code. After rebuild the plugin is regenerated and copied in the extension folder and then Archicad is relaunched and the loading process is made again.

I use this code to put my menu in the "palettes" menu :
// Interface definitions
GSErrCode	__ACDLL_CALL	RegisterInterface (void)
{
	InitializeLanguageCodes();

	GSErrCode err = ACAPI_Register_Menu (12500, 12520, MenuCode_Palettes, MenuFlag_Default);

And this is my .grc for the menu :
'STR#' 12500 "Strings for the Menu" {
/* [   ] */		"Show/Hide palette^E3^E2"
}

Before last week i had the same plugin working and the menu items where added to the "MenuCode_GDLObjects" menu. This worked well.

Now i have changed the user interface and i use a palette for the commands. So i wanted to change my menus and simply add one item for show/hide the palette in the palette menu (MenuCode_Palettes).

But my new "Show/Hide" menu item still appears in the "MenuCode_GDLObjects" menu. It seem's something is memorized somewhere. Very very strange.

I have searched in the registry for some ID's, i have of course restared the computer. Nothing changes.

Erenford
Booster
gehairing wrote:
Before last week i had the same plugin working and the menu items where added to the "MenuCode_GDLObjects" menu. This worked well.

Now i have changed the user interface and i use a palette for the commands. So i wanted to change my menus and simply add one item for show/hide the palette in the palette menu (MenuCode_Palettes).

But my new "Show/Hide" menu item still appears in the "MenuCode_GDLObjects" menu. It seem's something is memorized somewhere. Very very strange.
Sure you deleted traces of your old code in RegisterInterface or in grc?
Try to delete your local ArchiCAD cache, located in Users\[username]\AppData\Local\Graphisoft\ then restart ArchiCAD again.
You can also try the one in AppData\Roaming\, but I'm guessing its for your shortcuts and preferences.
Of course try to backup before deleting in case it gets screwy

Anyway we're getting a little off-topic so I'll stop now.
Archicad 25 5010 INT FULL
Archicad 26 5002 INT FULL
Visual Studio Professional 2019
Win 10 Pro 64-bit
gehairing
Participant
That was it. I've removed the cache and everything works
Thank's a lot and sorry if this was off topic (maybe not 😉 )