Smart Client Menu Bar methods
Posted: Wed Feb 04, 2015 7:59 pm
I have some enum's setup as arrays that contain the menu structure for the menu items in the Smart Client Menu Bar. The menu is drawn out prefectly, icons show, etc. The issue is with passing in the method for the menu item. For example, here is the array that contains the menu item information for the Exit item:
Where the array is structured as follows:
When creating the menu item with the following code:
I get the following error:
Can't find method com.servoy.extensions.plugins.window.menu.AbstractMenu.js_addMenuItem(string,string). (C:\workspace\solution\globals.js#100)
Can't find method com.servoy.extensions.plugins.window.menu.AbstractMenu.js_addMenuItem(string,string). (C:\workspace\solution\globals.js#100)
at C:\workspace\solution\globals.js:100 (onSolutionOpen_SmartClient)
Interestingly, if I create the menu item like this instead:
I get a different error that shows in a popup onSolutionOpen that states:
Method/Function is null
So, how can I get the method name I want to call into the addMenuItem function and be sure that I can call methods that are dynamic enough to either be contained in a form OR in a scope? For instance, if I have the exitSolution method in scopes.myutils I need to be able to specify that in the array as "scopes.myutils.exitSolution" or if it is in a form I would need to call it as "forms['myform']['exitSolution']".
Thanks!
- Code: Select all
['Exit', 'exitSolution', [], 'general/clean_general_cross_16.png', null, true]
Where the array is structured as follows:
- Code: Select all
[name {String}, feedback_item {Method}, feedback_args {Array}, icon {String}, mnemonic {String}, enabled {Boolean}]
When creating the menu item with the following code:
- Code: Select all
_jsMenuItem = _jsMenu.addMenuItem(_jsMenuItemArr[0],_jsMenuItemArr[1]);
I get the following error:
Can't find method com.servoy.extensions.plugins.window.menu.AbstractMenu.js_addMenuItem(string,string). (C:\workspace\solution\globals.js#100)
Can't find method com.servoy.extensions.plugins.window.menu.AbstractMenu.js_addMenuItem(string,string). (C:\workspace\solution\globals.js#100)
at C:\workspace\solution\globals.js:100 (onSolutionOpen_SmartClient)
Interestingly, if I create the menu item like this instead:
- Code: Select all
_jsMenuItem = _jsMenu.addMenuItem(_jsMenuItemArr[0]);
_jsMenuItem.setMethod(_jsMenuItemArr[1]);
I get a different error that shows in a popup onSolutionOpen that states:
Method/Function is null
So, how can I get the method name I want to call into the addMenuItem function and be sure that I can call methods that are dynamic enough to either be contained in a form OR in a scope? For instance, if I have the exitSolution method in scopes.myutils I need to be able to specify that in the array as "scopes.myutils.exitSolution" or if it is in a form I would need to call it as "forms['myform']['exitSolution']".
Thanks!