Community
Participate
Working Groups
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 (); }
PRODUCT VERSION: 116
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 (); }
Felipe please retest. Should be fixed already.
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.
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.