more than one submenu
Hi,
I have seen similar thread ( https://support.geneious.com/entries/22580561-How-do-I-create-more-than-one-submenu-item-) in the geneious forum.
This was a good idea to use in order to save some space, however due to basic coding skills, I have bit of trouble implementing idea.
My code:
In the my main plugin class:
public GeneiousActionOptions getParentActionOptions() {
return new GeneiousActionOptions("Editing Options").setInMainToolbar(true,0);
}
In class1:
public GeneiousActionOptions getActionOptions() {
MyPlugin k = new MyPlugin();
GeneiousActionOptions parent = k.getParentActionOptions();
GeneiousActionOptions submenuItem1 = new GeneiousActionOptions("Edit");
GeneiousActionOptions sub1 = parent.createSubmenuActionOptions(parent, submenuItem1);
return (sub1);
}
In class2:
public GeneiousActionOptions getActionOptions() {
MyPlugin k = new MyPlugin();
GeneiousActionOptions parent = k.getParentActionOptions();
GeneiousActionOptions submenuItem2 = new GeneiousActionOptions("Add");
GeneiousActionOptions sub2 = parent.createSubmenuActionOptions(parent, submenuItem2);
return (sub2);
}
But I can see only one of these two. Is this possible the right way of sharing the parent option?
Thanks for your help.
-
All classes that use the parent option must use the exact same instance of the parent options (eg. a singleton). This can easily be done with a static field. In your plugin class:
`public static final GeneiousActionOptions PARENT_OPTIONS = new GeneiousActionOptions("Editing Options").setInMainToolbar(true,0);`
Then in your other classes:
`GeneiousActionOptions sub1 = GeneiousActionOptions.createSubmenuActionOptions(MyPlugin.PARENT_OPTIONS, submenuItem2);`
0
Please sign in to leave a comment.
Comments
1 comment