I specify the precedent topic .
The goal is: to hide to some clients “Window” and not to hide to another client “Window”, in a form. Is it possible to make this with a method that set “showInMenu”? If yes, in what manner?
Tanks in advance.
Gianni Pinna
Hi Gianni,
Manipulating standard menus is not supported, I believe, although you can remove them all and then create your own.
Still, if you insist, In your case, hiding/showing the standard Windows menu bar can be achieved this way for example (in Servoy 4+):
/**
* The index of the 'Window' menu
*/
var windowsMenuIndex = 0;
/**
* A boolean to hold the visibility state of the 'Window' menu
*/
var windowsMenuShowing = true;
/**
* Callback method for when solution is opened.
*/
function onSolutionOpen() {
var cnt = plugins.menubar.getMenuCount();
for (var i = 0; i < cnt; i++) {
var menu = plugins.menubar.getMenu(i);
if (menu.text == 'Window') {
windowsMenuIndex = i;
}
}
}
/**
* @param (Boolean) set to true to show the menu, false to hide it
*/
function showHideWindowsMenu(show) {
if (show) {
plugins.menubar.resetMenuBar();
windowsMenuShowing = true;
} else {
plugins.menubar.removeMenu(windowsMenuIndex);
windowsMenuShowing = false;
}
plugins.menubar.validateMenuBar();
}
And now with Servoy 5.1, you will probably better use the new window plugin to do the same thing.
Hope this helps,
Tank You very much, Patrick. I am studying Your method. After studied and understood, I’ll inform You about the result.
Gianni Pinna.