Bug 4656 - Pop-up menu not showing for Composite (1GENYM0)
Summary: Pop-up menu not showing for Composite (1GENYM0)
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.0   Edit
Hardware: All Linux
: P5 normal (vote)
Target Milestone: ---   Edit
Assignee: Felipe Heidrich CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:20 EDT by Dejan Glozic CLA
Modified: 2002-09-11 14:35 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dejan Glozic CLA 2001-10-11 14:20:44 EDT
PDE uses Composite as a parent widget of a Form in its multi-page editors.
	It registers a pop-up menu for it with a few common items. On Windows,
	this pop-up menu shows up.

	On Linux, only pop-up menus that are registered against widgets
	like Table, Tree etc. show up.

	I am using 'setMenu' on the Control API. Note that I am creating
	one menu instance and calling setMenu on several controls. It works on
	Windows, but maybe Linux does not allow me to associate the same
	menu instance with several controls.

NOTES: n

	DG (6/1/2001 8:57:08 PM) -
		I don't know if it is related, but perspective buttons in the vertical left bar
		in the workbench also do not have pop-up menus with 'Close' and 'Close All' 
		entries on Linux.

	McQ (02/06/2001 10:49:24 AM) -
		The "pop up menus for the vertical left bar" problem has been fixed.
		
	SN (6/2/01 4:41:31 PM) -
		The following code works on both Windows and Linux.  DG needs to
		provide a test case or a series of steps.

public static void main (String [] args) {
	Display display = new Display ();
	Shell shell = new Shell (display);
	Composite c1 = new Composite (shell, SWT.BORDER);
	c1.setSize (100, 100);
	Composite c2 = new Composite (shell, SWT.BORDER);
	c2.setBounds (100, 0, 100, 100);
	Menu menu = new Menu (shell, SWT.POP_UP);
	MenuItem item = new MenuItem (menu, SWT.PUSH);
	item.setText ("Popup");
	c1.setMenu (menu);
	c2.setMenu (menu);
	shell.setMenu (menu);
	shell.setSize (300, 300);
	shell.open ();
	while (!shell.isDisposed ()) {
		if (!display.readAndDispatch ()) display.sleep ();
	}
	display.dispose ();
}
Comment 1 DJ Houghton CLA 2001-10-29 16:28:43 EST
PRODUCT VERSION:

	116

Comment 2 Stef van Dijk CLA 2002-02-08 14:52:30 EST
DG can correct me if I'm wrong, but I suspect the problem he's referring to 
occurs when a child composite obscures it's parent composite, and the menu has 
been assigned to the parent. It's a differenece in message propagation between 
Windows and Motif. Here's an updated example. On Windows, you can get the popup 
to appear over any of the 3 colored regions although it was only directly 
assigned to the parent (the red region). On Motif, nothing will happen if you 
attempt to get the popup menu over the child (magenta and cyan) regions.

	public static void main(String[] args) {
		Display display = new Display ();
		Shell shell = new Shell (display);
		
		Composite c1 = new Composite (shell, SWT.BORDER);
		c1.setSize (300, 300);
		c1.setBackground(display.getSystemColor(SWT.COLOR_RED));
		
		Composite c2 = new Composite (c1, SWT.BORDER);
		c2.setBounds (0, 0, 150, 200);
		c2.setBackground(display.getSystemColor(SWT.COLOR_MAGENTA));
		
		Composite c3 = new Composite (c1, SWT.BORDER);
		c3.setBounds (150, 0, 150, 200);
		c3.setBackground(display.getSystemColor(SWT.COLOR_CYAN));
		
		Menu menu = new Menu (shell, SWT.POP_UP);
		MenuItem item = new MenuItem (menu, SWT.PUSH);
		item.setText ("Popup");
		c1.setMenu (menu);
		
		shell.setMenu (menu);
		shell.setSize (300, 300);
		shell.open ();
		
		while (!shell.isDisposed ()) {
			if (!display.readAndDispatch ())
				display.sleep ();
		}
		
		display.dispose ();
	}
Comment 3 Veronika Irvine CLA 2002-09-10 11:07:15 EDT
Felipe please retest.  Should be fixed already.
Comment 4 Felipe Heidrich CLA 2002-09-11 14:12:00 EDT
Behaves the same way on Motif and Windows,
you only get the pop-up when you click over the red region, how it supposed to 
be.
Comment 5 Stef van Dijk CLA 2002-09-11 14:35:06 EDT
Ok, I assume the behavior has been changed on Windows platforms. It used to be 
possible to set the popup menu on a composite parent and have it appear when 
you right clicked over a composite child (which was not true on Linux).
Sounds like this has been fixed.