Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: marano on March 12, 2006, 11:53:09 pm

Title: Right Click Problem
Post by: marano on March 12, 2006, 11:53:09 pm
Hi. If i right click on a selected element i can get it. But when i right click an element that is not selected i can't get it altough   it becomes selected. Look at that code please(C#):
Code: [Select]

public object EA_GetMenuItems(EA.Repository Repository, string Location, string MenuName)
{
EA.Collection ec = Repository.GetCurrentDiagram().SelectedObjects;
MessageBox.Show(ec.Count.ToString());

}

I got "0" when i only right click, but "1" or when if I first left click or select objects before i right click. Somebody help please.

Title: Re: Right Click Problem
Post by: thomaskilian on March 13, 2006, 12:53:20 am
Hmm. I use GEtMenuItems only to build the menu. As soon as MenuClick is called, the collection is as expected. Maybe you're too early?
Title: Re: Right Click Problem
Post by: «Midnight» on March 13, 2006, 10:22:39 am
For what it's worth...

EA seems to have occasional problems identifying which item in the project view was right-clicked. For an example, try exporting a package that has not already first been selected by (say) left-clicking it; you'll find that EA might not bring up the dialog, even though it will provide the expected context menu. [NB: This may well be a limitation imposed by how Windows handles events when drag-and-drop is involved.]

Perhaps your problem is related to this. Try forcing the selected item to the one you want to work with, and see if the expected behavior returns.