Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] Shell size issue

Jeff,
   What I've been doing and I don't know if it is the most correct way to accomplish this is to have some like:

MyComposite extends Composite {

            ---- somewhere during constructor ----
            this.setLayout(new FillLayout());
            // add my widget to the Mycomposte instance
            this.layout();

            public static void main(String[] args) {
                Display display = Display.getDefault();
                Shell shell = new Shell(display);
                shell.setLayout(new FillLayout());

                MyComposite composite = new MyComposite(shell, SWT.NULL);                
                Point prefSize = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT);
                Rectangle shellBounds = shell.computeTrim(0,0,prefSize.x,prefSize.y);
                shell.setSize(shellBounds.width, shellBounds.height);
                shell.open();
                ...

Hope that helps,

Brian


> ----- Original Message -----
> From: Jeff.Schlaver@xxxxxxxxxxx
> To: platform-swt-dev@xxxxxxxxxxx
> Subject: [platform-swt-dev] Shell size issue
> Date: Thu, 7 Sep 2006 07:14:46 -0600
> 
> 
> Is there some default that is setting the shell size when one does not
> use shell.setSize(x,y). I though the Layout's (Layout and GridData) were
> used to set the size.  I have a shell that is huge and all I'm putting
> in the shell is a 400 x 100 composite.
> 
> My goal is to have the composite determine the size of the shell, and
> that is not happening.
> 
> I use Visual SWT and created a dummy shell with no size the properties
> say that the size is 173x 73 but when I run it on my PC it displays at
> 1024x768.
> What am I missing?
> 
> Thanks Jeff
> 
> _______________________________________________
> platform-swt-dev mailing list
> platform-swt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

>



Brian



Back to the top