Bug 28574 - Shell containing focussed Decorations gets lost
Summary: Shell containing focussed Decorations gets lost
Status: RESOLVED DUPLICATE of bug 29891
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Christophe Cornu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-17 16:50 EST by evansac CLA
Modified: 2003-05-01 18:08 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description evansac CLA 2002-12-17 16:50:34 EST
I'm trying to get MDI-like behaviour out of SWT. I noticed from the 
API that I could add a Decorations to a Shell, which is sort of what
I want (except that the main shell loses focus when the child Decorations
is selected.

The problem occurs if you select a Decorations and then switch to another
application, either via clicking, Alt-TAB or the windows taskbar. You'll 
find that you can't get back to your application via ALT-TAB (it's 
disappeared) or the taskbar (clicking the button doesn't bring the application
to the front). 

If you place the windows correctly you can see that the 
Decorations is getting the focus back when you click the taskbar button but 
it's just not coming to the front. 

Also, if you select the Decorations and do ALT-TAB you'll see that your
application has disappeared even before you switch to any other application.

Below is the code to create the application.

Cheers,

Alun

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Decorations;
import org.eclipse.swt.layout.FillLayout;

public class Main
{

  public static void main(String[] args)
  {
    Shell mainShell = new Shell(SWT.SHELL_TRIM);
    mainShell.setMaximized(true);
    mainShell.setLayout(new FillLayout());

    Decorations dec = new Decorations(mainShell, SWT.SHELL_TRIM);
    dec.setVisible(true);

    mainShell.pack();
    mainShell.open();

    Display display = mainShell.getDisplay();
    while (!mainShell.isDisposed())
    {
       if (!display.readAndDispatch()) display.sleep();
    }
  }

}
Comment 1 Grant Gayed CLA 2002-12-18 13:39:01 EST
Chrix to take a look.
Comment 2 Christophe Cornu CLA 2003-05-01 18:08:23 EDT
Please see https://bugs.eclipse.org/bugs/show_bug.cgi?id=29891#c8
Decorations is not meant to be used.

*** This bug has been marked as a duplicate of 29891 ***