How do I edit the entries on the bar containing Command, Navigation, Windows, and Help?
TYVM ![]()
I know this is an old thread but My question relates. I have about 50 Projects…is there a way to auto update or link the client scripts for the MenuBar Via any method besides opening up each project and importing the client script?
You could construct your menu programmatically in a shared script module, called from each project’s client startup event. You’d have to get familiar with Java’s menu model.
Do you have any sample code?
Automatic dropdown navigation menu (only adds folders one level deep):
from javax.swing import SwingUtilities, JMenu, JMenuBar, JMenuItem
from functools import partial
window = system.nav.getWindow("somewindow")
root = SwingUtilities.getRoot(window)
menu = root.getJMenuBar()
navmenu = JMenu("Navigation");
def handleSelect(event, target):
system.nav.swapTo(target)
trees = {}
leaves = []
for window in system.gui.getWindowNames():
winsplit = window.split('/')
if winsplit[0] != 'Nav':
menuItem = JMenuItem(winsplit[-1], actionPerformed=partial(handleSelect, target=window))
if len(winsplit) > 1:
if trees.get(winsplit[0]) is not None:
trees[winsplit[0]].add(menuItem)
else:
submenu = JMenu(winsplit[0])
submenu.add(menuItem)
trees[winsplit[0]] = submenu
else:
leaves.append(JMenuItem(window, actionPerformed=partial(handleSelect, target=window)))
for tree in trees:
navmenu.add(trees[tree])
for leaf in leaves:
navmenu.add(leaf)
menu.add(navmenu)
Thanks for the head start…I think this will get me where I want to be.