Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: hln on October 01, 2013, 07:45:03 pm
-
Hi,
I am develop Sparx Add-in and I have some questions:
- Can I set icon to my menu items?
- Can I select a type for my menu item? For instance: I want to some my menu items are "Radio Button" or "Checkbox" type.
Thanks
-
With regards to check box style menus, you can use code similar to the following
public void EA_GetMenuState(EA.Repository repository,
string menuLocation,
string menuName,
string itemName,
ref bool isEnabled,
ref bool isChecked)
{
switch (itemName)
{
case "&Enabled":
isEnabled = true;
isChecked = menuIsChecked;
break;
case "&About":
isEnabled = true;
break;
}
}
Where menuIsChecked is a local variable of type bool
To toggle the menu (i.e. react to the user menu click) use something similar to the following
public void EA_MenuClick(EA.Repository repository,
string menuLocation,
string menuName,
string itemName) {
switch (itemName) {
case "&Enabled" :
menuIsChecked = !menuIsChecked;
break;
case "&About" :
aboutBox = new AboutBox();
aboutBox.ShowDialog();
aboutBox = null;
break;
}
All the best
Phil
-
Just to be clear, you can only do the checkbox thing with menu's.
No icons or radio buttons or anything else fancy.
Geert
-
I have another question: how to add horizontal line in menu.
-
IIRC you simply supply a hyphen ('-').
q.
-
Hi!
Is there a way to add a shortcut key?
-
Isn't that what the & in front of a letter in the menu item name supposed to do?
I believe it works with either the Ctrl or Alt key, haven't tried in my extensions though
Cheers
Phil
-
It works when a menu is already open for navigation. But I want execute my function by pressing something like Ctr-Q without opening a menu and going through it.
It should look like this:
"My Function Ctr+Q"
-
AFAIR: Not possible. It has been asked here several times.
q.