Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [nebula-dev] computeSize in Control

trying to put the GeoMap into a scrollview based on its returned size is something that i don't really recommend. the world we are rendering is too big, to be put into reasonably sized scrollbars.

regards,
stepan



-------- Original-Nachricht --------
> Datum: Thu, 10 May 2012 09:33:08 -0600
> Von: Matthew Hall <qualidafial@xxxxxxxxx>
> An: Nebula Dev <nebula-dev@xxxxxxxxxxx>
> Betreff: Re: [nebula-dev] computeSize in Control

> The computeSize method should report the minimum size needed by the
> control. Expanding the control to fill available space is the
> responsibility of the container control, using layout data hints.
> 
> -Matthew
> On May 10, 2012 8:25 AM, "Hallvard Trætteberg" <hal@xxxxxxxxxxx> wrote:
> 
> > Hi,
> >
> > I have been looking at implementing computeSize in GeoMap, so it "grabs"
> > more space than the minimum when there are no constraints. I test it by
> > creating an anonymous subclass in GeoMapViewer's constructor. First I
> tried
> >
> >        public GeoMapViewer(Composite parent, int flags) {
> >                this(new GeoMap(parent, flags) {
> >                        @Override
> >                        public Point computeSize(int wHint, int hHint,
> > boolean changed) {
> >                                int w = (wHint != SWT.DEFAULT ? wHint :
> > Integer.MAX_VALUE);
> >                                int h = (hHint != SWT.DEFAULT ? hHint :
> > Integer.MAX_VALUE);
> >                                return new Point(w, h);
> >                        }
> >                });
> >        }
> >
> > The idea is to indicate that ideally GeoMap wants as much space as
> > possible. I was pretty surprised that the wish for Integer.MAX_VALUE
> width
> > and height was granted, in the sense that getSize() reported these
> > dimensions not that the layout actually gave it that much space. This
> gave
> > problems in the paint method, so I reduced the value from
> Integer.MAX_VALUE
> > to 256 * 8.
> >
> > Two question:
> > - (how) can the computeSize method say that it wants as much as
> possible,
> > but can accept nothing?
> > - why isn't the size returned by getSize() actually reduced to the
> visible
> > size instead of the value asked for by computeSize?
> >
> > Hallvard
> > ______________________________**_________________
> > nebula-dev mailing list
> > nebula-dev@xxxxxxxxxxx
> >
> https://dev.eclipse.org/**mailman/listinfo/nebula-dev<https://dev.eclipse.org/mailman/listinfo/nebula-dev>
> >

-- 
Stepan Rutz
Phone: +49 (0) 178 654 9284
Email: stepan.rutz@xxxxxx
Earth: Brunnenallee 25a, 50226 Frechen, Germany

Empfehlen Sie GMX DSL Ihren Freunden und Bekannten und wir
belohnen Sie mit bis zu 50,- Euro! https://freundschaftswerbung.gmx.de


Back to the top