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

Alternatively, you can add a resize listener to the composite, extend the layout manager to allow resizing of the composite outside the parent composite bounds, and resize the shell on composite resize.  The issue with this is there's a possibility of causing a recursive loop (since Shell#setSize(int, int) calls layout(int, int, boolean)).

Usage questions like this should be directed to the eclipse.platform.swt newsgroup.  Usually you will get quicker responses.

Daniel

On 9/7/06, Brian Sam-Bodden <bsbodden@xxxxxxxxxxxxxxx> wrote:
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

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top