Author Topic: EA_GetMenuState  (Read 4491 times)

gilles2

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
EA_GetMenuState
« 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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_GetMenuState
« Reply #1 on: November 17, 2010, 05:12:33 pm »
Gilles,

I fail to see your problem  :-/

Geert

gilles2

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: EA_GetMenuState
« Reply #2 on: November 17, 2010, 08:03:43 pm »
Thanks anyway, for replying Geert !

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_GetMenuState
« Reply #3 on: November 17, 2010, 08:05:57 pm »
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
« Last Edit: November 17, 2010, 08:06:28 pm by Geert.Bellekens »

gilles2

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: EA_GetMenuState
« Reply #4 on: November 18, 2010, 09:06:02 pm »
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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13136
  • Karma: +547/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA_GetMenuState
« Reply #5 on: November 18, 2010, 09:15:01 pm »
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

gilles2

  • EA User
  • **
  • Posts: 20
  • Karma: +0/-0
    • View Profile
Re: EA_GetMenuState
« Reply #6 on: November 19, 2010, 12:25:03 am »
I know the idea,
I am just saying that in some cases the behaviour is strange and I don't understand why.