I have started playing around with this plugin but I think I have hit a snag. There doesn’t seem to be any way to pass arguments to the method associated with a menu item. For instance, this works fine:
var elementName = application.getMethodTriggerElementName();
var submenu = new Array(
plugins.popupmenu.createMenuItem( "Units", set_trackUHBN_1 ),
plugins.popupmenu.createMenuItem( "Hours", set_trackUHBN_2 ),
plugins.popupmenu.createMenuItem( "Units And Hours", set_trackUHBN_3 ),
plugins.popupmenu.createMenuItem( "Neither", set_trackUHBN_4 )
)
var menu = new Array(
plugins.popupmenu.createMenuItem("<html><b>Track Service In...</b></html>",submenu)
)
elem = elements[ elementName ];
plugins.popupmenu.showPopupMenu( elem, menu);
where the four separate methods such as set_trackUHBN_1 are :
track_units_hours_neither_both = 1;
controller.saveData();
However, it sure would be great if I could do this:
var elementName = application.getMethodTriggerElementName();
var submenu = new Array(
plugins.popupmenu.createMenuItem( "Units", set_trackUHBN(1) ),
plugins.popupmenu.createMenuItem( "Hours", set_trackUHBN(2) ),
plugins.popupmenu.createMenuItem( "Units And Hours", set_trackUHBN(3) ),
plugins.popupmenu.createMenuItem( "Neither", set_trackUHBN(4) )
)
var menu = new Array(
plugins.popupmenu.createMenuItem("<html><b>Track Service In...</b></html>",submenu)
)
elem = elements[ elementName ];
plugins.popupmenu.showPopupMenu( elem, menu);
and the method set_trackUHBN could be:
track_units_hours_neither_both = arguments[ 0 ];
controller.saveData();
What happens now if I try this is that the method executes as the plugin creates the menu items. I know you are thinking, “Why not just use a value list?” Since the width of a value list is determined by the width of its associated field, I wouldn’t be able to do this:
Am I missing something or is the ablility to specify a method that inludes arguments not possible with this plugin?
Steve in LA