-
1 Jul 2010 1:38 AM #1
Can't add Menu to TabItem
Can't add Menu to TabItem
Just tried Googling this to which the perfect link came up however it didn't load.
I'd like to a Menu to the TabItem 'header' section, i.e. the little tab bit that contains the name of the tab in the TabPanel.
I've tried a simple:
This isn't working. Am I right in assuming this setContextMenu *should* do what I desire?Code:/* * Class that extends TabItem * Constructor then calls the following method: */ final Menu menu = new Menu(); menu.setWidth(150); final MenuItem renameTab = new MenuItem(); renameTab.setText("Rename Tab"); renameTab.setIconStyle("expand"); renameTab.addSelectionListener(new SelectionListener<MenuEvent>() { @Override public void componentSelected(MenuEvent ce) { final Listener<MessageBoxEvent> l = new Listener<MessageBoxEvent>() { @Override public void handleEvent(MessageBoxEvent be) { if(be.getButtonClicked().getItemId().equals(Dialog.NO)) { } else if(be.getButtonClicked().getItemId().equals(Dialog.YES)) { } } }; MessageBox.confirm("dostuff", "Are you sure?" , l); } }); menu.add(renameTab); setContextMenu(menu);
-
28 Oct 2010 12:17 AM #2
I also encountered this issue. Why there is nobody answer it?
-
28 Oct 2010 3:08 AM #3
The header is not part of the TabItem. You need to assign the menu to your TabPanel. Then you also need to add an Events.ContextMenu listener. The listener needs to cancel that event if the target is not the header stripe.
Similar Threads
-
Adding a 'Right-Click' Menu to a TabItem [source included]
By mwmcmullen in forum Ext GWT: DiscussionReplies: 0Last Post: 9 Jun 2010, 5:11 AM -
Can't add a EditorGrid inside a TabItem on GXT 2.0 M2
By edumrf in forum Ext GWT: DiscussionReplies: 9Last Post: 10 Jul 2009, 11:30 AM -
How to add context menu to HeaderItem of the TabItem?
By moldoe in forum Ext GWT: Help & Discussion (1.x)Replies: 10Last Post: 20 Apr 2009, 8:02 AM -
How to add a close button on the tabItem title
By javist in forum Ext 1.x: Help & DiscussionReplies: 2Last Post: 4 Nov 2006, 4:22 PM


Reply With Quote