Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: gilles2 on November 17, 2010, 04:19:53 am
-
Hi all,
I am currently working on EA_GetMenuState method from the API, and i am having quite strange troubles.
My scenario :
I go to addin Main menu.
EA_GetMenuState is called for each submenus to decide how to display them and depending on my business layer some submenus are enabled and other no!
All works fine here.
Now, I click on an enabled submenu.
First strange thing, EA_GetMenuState is called again on this submenu (before the click). I was thinking the EA_GetMenuState was called before the display of a menu, not when clicking on it before calling EA_Click....
Moreover, if the last thing I focus on in the project browser, is a package (easy to reproduce), the EA_GetMenuState called to display my submenu has a menuLocation equal to MainMenu, so my submenu is enabled, the EA_GetMenuState called when clicking on the same submenu, has a menu location equals to TreeView. So my problem....
8-|
Using EA 7.5 or EA 8.0.
Thanks for your replies,
regards,
Gilles
-
Gilles,
I fail to see your problem :-/
Geert
-
Thanks anyway, for replying Geert !
-
Gilles, I'm happy to help, but If I don't see your problem, the I can't :-?
Maybe you can try to explain the problem a bit more...
Geert
-
Ok i'll try :
First problem : I don't understand why event EA_GetMenuState is raised twice by EA for a unique menu item.
A first time when EA displays it
A second time when you click on it just before the event EA_MenuClick is raised.
Second problem.
I noticed that that the parameter menuLocation sent by EA to my code was sometimes having a wrong value.
The EA_GetMenuState called when displaying an item menu in the Main menu always provides the good value for MenuLocation : "MainMenu".
But the EA_GetMenuState called when clicking on an item menu of the main menu, gives sometimes the value "TreeView" : when the last thing you did before displaying the menu was to click on a package in the project browser.
Gilles
-
Gilles,
The idea is that you can enable or disable menu items depending on the selected object or the location (main menu or context menu).
I've used that feature a lot in my addins, and I've never had any issues with it, it always worked as expected.
Geert
-
I know the idea,
I am just saying that in some cases the behaviour is strange and I don't understand why.