Popup menu addCustomItem and keyboard focus


#1

Hi

I'm experimenting with adding a custom menu item to my main menu. It should be a component with a TreeView and a search filed.

My component works good on windows but on osx I'm having some issues.

1. The native osx menu bar does not display the custom component. not that surprising I guess.

2. If i don't use the native menu bar, I get the component to display, but it can't get keyboard focus. clicking on the text field does nothing.

I've tried adding some other control to the component, but none of them get keyboard focus on osx

Any help would be great. Also if there is a workaround, maybe not using addCustomItem at all. I just need to be able to click the to level menu item and display my component, then make it go away when the user clicks outside.

 

Regards

Nikolai

 


#2

Wouldn't a CalloutBox for better for that than a menu? It's a bit strange to try to put complex things like trees into a menu, but it's the sort of thing I designed the CalloutBox for.


#3

Thanks for getting back to me on this.

Yes maybe a CalloutBox is better, although a list in a menu with a search field does not seem that crazy to me.

What I can't figure out though is how to respond to the user clicking on a menubar item.

I can't use getMenuForIndex with a calloutbox. Is there some method that I can override to be notified when a user clicks on the toplevel menu.

 

So the menu might look like this:

File Edit List Help

So all other menus then List will get their popup menu from getMenuForIndex, but the List item should popup the calloutbox instead.

Any ideas?