Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » CTabFolder menu problem(Menu faulty display for CTabFolder)
CTabFolder menu problem [message #1385255] Thu, 05 June 2014 08:28 Go to next message
Octavian Motataeanu is currently offline Octavian MotataeanuFriend
Messages: 2
Registered: June 2014
Junior Member
When setting the menu on a CTabFolder component, the popup is displayed wherever the user right-clicks inside a CTabItem's content, instead of just showing the menu on right-click on tab item titles.

Code snippet:
RWT start point:
public class EntryPointCTab implements EntryPoint {

	@Override
	public int createUI() {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Show CTabFolder");
		ShowCTabFolder content = new ShowCTabFolder();
		content.createContents(shell);
		shell.open();
		return 0;
	}
}


SWT start point:
public class SWTEntryPoint {
	
	public static void main(String[] args) {
		new SWTEntryPoint().run();
	}

	/**
	 * Runs the application
	 */
	public void run() {
		Display display = new Display();
		Shell shell = new Shell(display);
		shell.setText("Show CTabFolder");
		ShowCTabFolder content = new ShowCTabFolder();
		content.createContents(shell);
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch()) {
				display.sleep();
			}
		}
		display.dispose();
	}
}


Common code:
public class ShowCTabFolder {
	private CTabFolder tabFolder;

	/**
	 * Creates the window's contents
	 * 
	 * @param shell
	 *            the parent shell
	 */
	public void createContents(Shell shell) {
		shell.setLayout(new GridLayout(1, true));

		// Create the tabs
		tabFolder = new CTabFolder(shell, SWT.TOP);
		tabFolder.setLayout(new GridLayout());
		tabFolder.setLayoutData(new GridData(GridData.FILL_BOTH));
		Menu tabfmenu = new Menu(tabFolder);
		MenuItem tfmi1 = new MenuItem(tabfmenu, SWT.POP_UP);
		tfmi1.setText("Menu popup");
		tabFolder.setMenu(tabfmenu);

		// Create an actual tab
		CTabItem tab1 = new CTabItem(tabFolder, SWT.NONE);
		tab1.setText("Tab (1)");
		Composite tab1comp = new Composite(tabFolder, SWT.NONE);
		tab1comp.setLayoutData(new GridData(GridData.FILL_BOTH));
		tab1comp.setLayout(new GridLayout());
		tab1comp.setBackground(Display.getCurrent().getSystemColor(
				SWT.COLOR_BLUE));
		Button btn1 = new Button(tab1comp, SWT.PUSH);
		btn1.setText("Some text");
		new Text(tab1comp, SWT.NONE);
		tab1.setControl(tab1comp);
	}
}


If you right click on the button or just a random location of the ctabitem composite, the menu is displayed. This does not happen in RCP. Replace the CTabFolder and CTabItem with normal TabFolder and TabItem and it will behave normally, displaying the menu like in RCP.
I am assuming this is a bug, but posted here to make sure I am not wrong or do not make a duplicate in bugzilla.
If this is a bug, is there any quick way arround it?

P.S: When dealing with this problem, I also noticed that if I have a TreeViewer set in the ctabitem content, the problem can be avoided by firs selecting an item in the table, and then right clicking will display the menu of the table, not the CTabFolder. But this still leaves the problem when right-clicking without selecting a tree item, the CTabFolder menu will be displayed instead.
Re: CTabFolder menu problem [message #1433945 is a reply to message #1385255] Mon, 29 September 2014 12:55 Go to previous messageGo to next message
Nita Adrian Dan is currently offline Nita Adrian DanFriend
Messages: 1
Registered: September 2014
Junior Member
Is there anybody else who has this problem?! Do we have a workaround for this ?!
Re: CTabFolder menu problem [message #1433999 is a reply to message #1433945] Mon, 29 September 2014 14:28 Go to previous message
Ivan Furnadjiev is currently offline Ivan FurnadjievFriend
Messages: 2334
Registered: July 2009
Location: Sofia, Bulgaria
Senior Member
Hi,
is the behavior differ between RAP and SWT? If yes, please open a
bugzilla and attach a snippet to reproduce it there.
Thanks,
Ivan

--
Ivan Furnadjiev

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Previous Topic:Using an image in body.html for a branding
Next Topic:RAP elements invisible if border-radius > 0 on Chrome
Goto Forum:
  


Current Time: Tue Feb 18 06:08:17 GMT 2020

Powered by FUDForum. Page generated in 0.04360 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top