2022-06-13 11:41 PM - edited 2022-06-14 12:07 AM
Archicad 23 | Visual Studio 2017
I have implemented...
in the .hpp file:
#define JHP_BIMCOORD_MENU_STRINGSID 32500
in the GRC file:
'STR#' JHP_BIMCOORD_MENU_STRINGSID "Strings for the Menu" {
/* [ ] */ "JHP"
/* [ ] */ "BIM Coordinators"
/* [ 1] */ "BIMcloud Project Space^ES^EE^EI^ED^EW^E3^EL^32501"
/* [ 2] */ "Audit Schedule^ES^EE^EI^ED^EW^E3^EL^32502"
}
'STR#' 32520 "Status Bar Strings for the Menu" {
/* [ ] */ "JHP"
/* [ ] */ "BIM Coordinators"
/* [ 1] */ "JHP message 01"
/* [ 2] */ "JHP message 02"
}
in the RegisterInterface function:
//------------------------------------------------------
// Interface definitions
//------------------------------------------------------
GSErrCode __ACENV_CALL RegisterInterface (void)
{
GSErrCode err = NoError;
err = ACAPI_Register_Menu (JHP_BIMCOORD_MENU_STRINGSID, 32520, MenuCode_UserDef, MenuFlag_Default);
return err;
}
// RegisterInterface
I am getting the inspiration for this approach from here:
https://archicadapi.Graphisoft.com/documentation/acapi_register_menu
The only difference I see is in the third argument for ACAPI_Register_Menu(), but I expect that and the menu items still perform as designed.
I have also reviewed the Teamwork_Control project from the Examples.
Third argument is the same.
I am hoping to send the message to the status bar by making the "BIM Coordinators" selection from the menu.
However, I am not able to make these test messages appear with any type of selection of the corresponding menu items. Am I misunderstanding how this is designed to work? Am I missing a piece to this puzzle?
Any point in the right direction is appreciated.
Chris
Solved! Go to Solution.
2022-06-15 10:36 AM - edited 2022-06-15 10:37 AM
Hi Chris,
I checked how it is behaving in a project I'm working on and I noticed that there are generally no prompt strings for the menu items which have subitems. This is also true for Archicad's own menus. Only menu items at the "leaves" of the menu tree display their status prompt message.
So a prompt message for "BIM Coordinators" probably doesn't work.
Do you see messages for "BIMcloud Project Space" and "Audit Schedule"?
2022-06-15 10:36 AM - edited 2022-06-15 10:37 AM
Hi Chris,
I checked how it is behaving in a project I'm working on and I noticed that there are generally no prompt strings for the menu items which have subitems. This is also true for Archicad's own menus. Only menu items at the "leaves" of the menu tree display their status prompt message.
So a prompt message for "BIM Coordinators" probably doesn't work.
Do you see messages for "BIMcloud Project Space" and "Audit Schedule"?
2022-06-15 06:37 PM - edited 2022-06-16 12:33 AM
Hello Bernd,
Thanks for the reply.
This morning, I am seeing my custom prompt messages while hovering over the "BIMcloud Project Space" and "Audit Schedule" leaves of the menu tree. Not sure why that was not more apparent yesterday afternoon. Maybe eye/hand coordination and reaction time is a little fresher for me this morning. Thanks for pointing out the obvious.
The test messages I am able to see on the status bar are currently hard coded into the .grc file. I would like to display the value of a custom parameter that is stored in [File > Info > Project Info...]. I can capture the value and am just now beginning to determine a way to get this info presented in the status bar as though it was hard coded in the .grc file. At this time, I am not sure if this will be a no-brainer or impossible.
Can you share any ideas on the presentation of this kind of information?
Maybe a user defined function that returns a string in place of the hard coded text that I have in the .grc file? For example:
'STR#' 32520 "Status Bar Strings for the Menu" {
/* [ ] */ "JHP"
/* [ ] */ "BIM Coordinators"
/* [ 1] */ WriteToStatusBar();
/* [ 2] */ WriteToStatusBar();
}
Maybe a single, built -in function with a string argument that writes directly to the status bar instead of relying on the hard coded text in .grc file? For example:
ACAPI_WriteToStatusBar ("Custom message");
Exploring these options now...
Thanks again!
Chris
2022-06-16 10:40 AM
Hi Chris,
Glad to hear that your first issue is resolved 🙂
I'm leaning in direction of impossible for dynamically changing the status prompt text for menu items when relying on AC API native functionality. My reasoning is:
1. The .grc files are compiled and then the compiled binary data is included in your Add-On's binary. So dynamically changing this seems not feasible to me.
2. I couldn't find any API function to change the status prompt. (There are functions to change the menu item text though. See: https://archicadapi.Graphisoft.com/documentation/acapi_interface)
So if you want to stay only in the AC API I would recommend to look into a different way to display this information. Maybe the menu item text or a separate palette to display it.
That said, I think it's possible to manipulate the whole AC window by other means. Either directly via the Windows API or by using AutoHotKey or AutoIt v3 (or similar). I haven't really used those options too much and especially not to manipulate the AC window, so I can only give you rough hints. I think there are also similar solutions for macOS in case it's needed, but I'm even less experienced there.
Hope this helps!
2022-06-16 05:34 PM
Dude - this is great information! Thanks so much for your thorough responses. I looked pretty hard for a native API function to change the status bar message, but missed the function to change the menu item text. I will look in to that. It was an easy jump to provide an additional menu selection at the 'leaf' level to generate a message box with the data.
Thanks again - chris