I have tray icon and I’ve attached a menu to it so that when the user right clicks on it, it pops up.
At point in my application I’d like to disable the content menu from showing and the re-enable it again later. How I do this? I haven’t been able to find an example and doing mnuPopup.setEnabled(false) doesn’t seem to work.
Here’s the snippet of code that creates the tray icon and attaches the menu to it.
Tray trySysTray = display.getSystemTray();
Menu mnuPopup = new Menu(shell, SWT.POP_UP);
TrayItem itmTrayItem = new TrayItem(trySysTray, SWT.NONE);
itmTrayItem.addListener(SWT.MenuDetect, new Listener() {
public void handleEvent(Event event) {
mnuPopup.setVisible(true);
}
});
The following should do the job: